pipecd icon indicating copy to clipboard operation
pipecd copied to clipboard

fix: for error wrapping in cancelDeployment

Open kunal-yelgate opened this issue 5 months ago • 0 comments

What happened?

In pkg/app/piped/controller/controller.go, the cancelDeployment function formats an error using %v instead of %w when wrapping an underlying error returned from ReportDeploymentCompleted.

This causes the original error to be stringified rather than properly wrapped, breaking Go error chaining. As a result, callers cannot use errors.Is() or errors.As() to inspect or match the underlying error.

In contrast, other functions in the same file (e.g. reportApplicationDeployingStatus) correctly use %w for error wrapping.


Affected code location

File: pkg/app/piped/controller/controller.go

cancelDeployment (~line 650):

err = fmt.Errorf("failed to report deployment status to control-plane: %v", err)

kunal-yelgate avatar Jun 23 '26 15:06 kunal-yelgate