From fb45032eb60cf9f79d6980157ab95959d2697868 Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Thu, 27 Jan 2022 21:42:00 +0100 Subject: [PATCH] controllers: only handle BuildError All other errors returned by `build*` are already properly wrapped. Signed-off-by: Hidde Beydals --- controllers/helmchart_controller.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/controllers/helmchart_controller.go b/controllers/helmchart_controller.go index 865acd8c..e8a5c015 100644 --- a/controllers/helmchart_controller.go +++ b/controllers/helmchart_controller.go @@ -368,15 +368,14 @@ func (r *HelmChartReconciler) reconcileSource(ctx context.Context, obj *sourcev1 // Handle any build error if retErr != nil { - e := fmt.Errorf("failed to build chart from source artifact: %w", retErr) - retErr = &serror.Event{ - Err: e, - Reason: meta.FailedReason, - } - if buildErr := new(chart.BuildError); errors.As(e, &buildErr) { + if buildErr := new(chart.BuildError); errors.As(retErr, &buildErr) { + retErr = &serror.Event{ + Err: buildErr, + Reason: buildErr.Reason.Reason, + } if chart.IsPersistentBuildErrorReason(buildErr.Reason) { retErr = &serror.Stalling{ - Err: e, + Err: buildErr, Reason: buildErr.Reason.Reason, } }