From d9e922d5be40a8bede0e355b78fb56bb27fe4ec1 Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Sat, 12 Oct 2024 13:30:46 +0300 Subject: [PATCH] return error when regex generation fails --- driver/groupdriver.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/driver/groupdriver.go b/driver/groupdriver.go index 9b3796e..68cb7e3 100644 --- a/driver/groupdriver.go +++ b/driver/groupdriver.go @@ -14,7 +14,10 @@ type Step struct { func (s *Step) MatchesExpectedContent(content []byte) (bool, error) { pattern := regexp.QuoteMeta(s.ExpectedContent) - re, _ := regexp.Compile(pattern) + re, err := regexp.Compile(pattern) + if err != nil { + return false, err + } if re.Match([]byte(content)) { return true, nil }