Wrap creates a new [WrappedError] with the given error and options. It gets the stack trace from the call site. If the provided error already an [Error], it clones its context and applies the new options to it. If the provided error is already an [WrappedError], it rewraps its inner error to avoid
(err error, opts ...Option)
| 31 | // If the provided error is already an [WrappedError], it rewraps its inner error |
| 32 | // to avoid double wrapping. |
| 33 | func Wrap(err error, opts ...Option) Error { |
| 34 | return WrapWithStackSkip(err, 1, opts...) |
| 35 | } |
| 36 | |
| 37 | // WrapWithStackSkip creates a new [WrappedError] with the given error and options. |
| 38 | // It the first stackSkip frames from the call stack. |