Skip to content

Commit

Permalink
fix(generic): ignore jsonpath errs on Condition search
Browse files Browse the repository at this point in the history
Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
  • Loading branch information
ilya-lesikov committed Jul 29, 2022
1 parent e0b8f7c commit 8d88c65
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/utils/json.go
Expand Up @@ -17,12 +17,12 @@ func JSONPath(tmpl string, input interface{}) (result string, found bool, err er

resultBuf := &bytes.Buffer{}
if err := jsonPath.Execute(resultBuf, input); err != nil {
if strings.HasSuffix(err.Error(), " is not found") {
return "", false, nil
} else {
return "", false, fmt.Errorf("error executing jsonpath: %w", err)
if debug() && !strings.HasSuffix(err.Error(), " is not found") {
fmt.Printf("error executing jsonpath for tmpl %q and input %v: %s\n", tmpl, input, err)
}
return "", false, nil
}

if strings.TrimSpace(resultBuf.String()) == "" {
return "", false, nil
}
Expand Down

0 comments on commit 8d88c65

Please sign in to comment.