Fixed a issue with random invalid matches in DSL
@@ -59,7 +59,9 @@ func (matcher *Matcher) MatchWords(corpus string, data map[string]interface{}) (
word, err = expressions.Evaluate(word, data)
if err != nil {
gologger.Warning().Msgf("Error while evaluating word matcher: %q", word)
- continue
+ if matcher.condition == ANDCondition {
+ return false, []string{}
+ }
}
// Continue if the word doesn't match
if !strings.Contains(corpus, word) {
@@ -180,6 +182,9 @@ func (matcher *Matcher) MatchDSL(data map[string]interface{}) bool {
result, err := expression.Evaluate(data)
if err != nil {
+ if matcher.condition == ANDCondition {
+ return false
+ }
if strings.Contains(err.Error(), "No parameter") {
gologger.Warning().Msgf("[%s] %s", data["template-id"], err.Error())
} else {
