When to use errors.WithStack(err)
in the code?
#3426
-
In the code guidelines here: https://velero.io/docs/v1.5/code-standards/#code it says:
Can this be clarified? For example, I would think the error below would qualify to be logged with stack, but as we can see from the output of the log message when using with/without stack it is the same: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I interpret the documentation to mean "Any Go package that is not within the Velero codebase, including standard library, should be returned with errors.WithStack." Other functions like |
Beta Was this translation helpful? Give feedback.
I interpret the documentation to mean "Any Go package that is not within the Velero codebase, including standard library, should be returned with errors.WithStack."
Other functions like
errrors.Wrap
actually doWithStack
under the hood, if I remember correctly.