WithCause returns the error with the given cause set. Overwriting an existing cause in the Error will cause a panic.
(cause error)
| 39 | // WithCause returns the error with the given cause set. |
| 40 | // Overwriting an existing cause in the Error will cause a panic. |
| 41 | func (e *Error) WithCause(cause error) *Error { |
| 42 | if e == nil { |
| 43 | return nil |
| 44 | } |
| 45 | dup := *e |
| 46 | dup.setCause(cause) |
| 47 | return &dup |
| 48 | } |
| 49 | |
| 50 | // WithCause returns a new error from the definition, and sets the cause of the error. |
| 51 | func (d *Definition) WithCause(cause error) *Error { |