From 6a8085522a021729f45985cfd54219d32087c6a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?= Date: Mon, 26 Sep 2022 15:33:52 +0200 Subject: [PATCH] fix: jmespath random error handling (#4697) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Charles-Edouard Brétéché Signed-off-by: Charles-Edouard Brétéché --- pkg/engine/jmespath/functions.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/engine/jmespath/functions.go b/pkg/engine/jmespath/functions.go index 09ffc21d5c..9651150c7f 100644 --- a/pkg/engine/jmespath/functions.go +++ b/pkg/engine/jmespath/functions.go @@ -961,7 +961,7 @@ func jpRandom(arguments []interface{}) (interface{}, error) { rand.Seed(time.Now().UnixNano()) ans, err := regen.Generate(pattern) if err != nil { - fmt.Println("Invalid Pattern: ", err) + return nil, err } return ans, nil }