From 330abc7ebd4a779089063618eb47e54d5b925be3 Mon Sep 17 00:00:00 2001 From: boiledfroginthewell Date: Thu, 17 Oct 2024 22:16:55 +0900 Subject: [PATCH] chore: show expr errors for #13759 Signed-off-by: boiledfroginthewell --- util/template/expression_template.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/util/template/expression_template.go b/util/template/expression_template.go index 94ab2b8b5621..050e173ca13c 100644 --- a/util/template/expression_template.go +++ b/util/template/expression_template.go @@ -54,13 +54,17 @@ func expressionReplace(w io.Writer, expression string, env map[string]interface{ // This allowUnresolved check is not great // it allows for errors that are obviously // not failed reference checks to also pass + if err != nil { + fmt.Println("failed to compile:", err) + } if err != nil && !allowUnresolved { return 0, fmt.Errorf("failed to evaluate expression: %w", err) } result, err := expr.Run(program, env) if (err != nil || result == nil) && allowUnresolved { // result is also un-resolved, and any error can be unresolved - log.WithError(err).Debug("Result and error are unresolved") + log.WithError(err).Infof("Result and error are unresolved: result=%v", result) + fmt.Println("", err) return w.Write([]byte(fmt.Sprintf("{{%s%s}}", kindExpression, expression))) } if err != nil {