Skip to content

Commit

Permalink
chore: rebuild error chain
Browse files Browse the repository at this point in the history
  • Loading branch information
thisislawatts committed Feb 20, 2025
1 parent 355caa7 commit ae03e33
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cliv2/cmd/cliv2/errorhandling.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,19 @@ func decorateError(err error, meta map[string]any) error {
snyk_errors.WithMeta(k, v)(&errorCatalogError)
}

return errorCatalogError
// Rebuild the error chain, replacing the original errorCatalogError
var newErr error = errorCatalogError
current := err
for current != nil {
if current.Error() == errorCatalogError.Error() {
current = errors.Unwrap(current)
continue
}
newErr = errors.Join(newErr, current)
current = errors.Unwrap(current)
}

return newErr
}

genericError := cli.NewGeneralCLIFailureError(err.Error())
Expand Down

0 comments on commit ae03e33

Please sign in to comment.