Wrap adds a context message and stack trace to err and returns a new error with the new context. Arguments are handled as in fmt.Print. Use Root to recover the original error wrapped by one or more calls to Wrap. Use Stack to recover the stack trace. Wrap returns nil if err is nil.
(err error, a ...interface{})
| 64 | // Use Stack to recover the stack trace. |
| 65 | // Wrap returns nil if err is nil. |
| 66 | func Wrap(err error, a ...interface{}) error { |
| 67 | if err == nil { |
| 68 | return nil |
| 69 | } |
| 70 | return wrap(err, fmt.Sprint(a...), 1) |
| 71 | } |
| 72 | |
| 73 | // Wrapf is like Wrap, but arguments are handled as in fmt.Printf. |
| 74 | func Wrapf(err error, format string, a ...interface{}) error { |