return error when regex generation fails
This commit is contained in:
parent
0837933b6c
commit
d9e922d5be
@ -14,7 +14,10 @@ type Step struct {
|
|||||||
|
|
||||||
func (s *Step) MatchesExpectedContent(content []byte) (bool, error) {
|
func (s *Step) MatchesExpectedContent(content []byte) (bool, error) {
|
||||||
pattern := regexp.QuoteMeta(s.ExpectedContent)
|
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)) {
|
if re.Match([]byte(content)) {
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user