1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-31 03:45:17 +00:00

Fix: Error cause is missing ()

Include the message of an error happening during mutation of elements of
a `foreach` loop.

Signed-off-by: Andreas Brehmer <andreas.brehmer@sap.com>
Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
Andreas Brehmer 2023-06-16 13:39:29 +02:00 committed by GitHub
parent a21c5fb347
commit 0344f52d6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,6 +2,7 @@ package mutation
import (
"context"
"errors"
"fmt"
"github.com/go-logr/logr"
@ -36,7 +37,7 @@ func (f *forEachMutator) mutateForEach(ctx context.Context) *mutate.Response {
mutateResp := f.mutateElements(ctx, foreach, elements)
if mutateResp.Status == engineapi.RuleStatusError {
return mutate.NewErrorResponse("failed to mutate elements", err)
return mutate.NewErrorResponse("failed to mutate elements", errors.New(mutateResp.Message))
}
if mutateResp.Status != engineapi.RuleStatusSkip {