diff --git a/pkg/utils/json.go b/pkg/utils/json.go index 3f097b3..8fd8915 100644 --- a/pkg/utils/json.go +++ b/pkg/utils/json.go @@ -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 }