Root returns the original error that was wrapped by one or more calls to Wrap. If e does not wrap other errors, it will be returned as-is.
(e error)
| 29 | // calls to Wrap. If e does not wrap other errors, it will be returned |
| 30 | // as-is. |
| 31 | func Root(e error) error { |
| 32 | if wErr, ok := e.(wrapperError); ok { |
| 33 | return wErr.root |
| 34 | } |
| 35 | return e |
| 36 | } |
| 37 | |
| 38 | // wrap adds a context message and stack trace to err and returns a new error |
| 39 | // containing the new context. This function is meant to be composed within |
no outgoing calls