Fix #123: Deduplicate result errors

This commit is contained in:
TwinProduction
2021-06-05 18:50:24 -04:00
parent 5e00752c5a
commit 8997eeef05
5 changed files with 50 additions and 8 deletions

View File

@ -126,7 +126,7 @@ func (c Condition) evaluate(result *Result) bool {
conditionToDisplay = prettifyNumericalParameters(parameters, resolvedParameters, "<")
}
} else {
result.Errors = append(result.Errors, fmt.Sprintf("invalid condition '%s' has been provided", condition))
result.AddError(fmt.Sprintf("invalid condition '%s' has been provided", condition))
return false
}
if !success {
@ -242,7 +242,7 @@ func sanitizeAndResolve(elements []string, result *Result) ([]string, []string)
} else {
if err != nil {
if err.Error() != "unexpected end of JSON input" {
result.Errors = append(result.Errors, err.Error())
result.AddError(err.Error())
}
if checkingForLength {
element = LengthFunctionPrefix + element + FunctionSuffix + " " + InvalidConditionElementSuffix