(cause error)
| 21 | } |
| 22 | |
| 23 | func (e *Error) setCause(cause error) { |
| 24 | if cause == nil { |
| 25 | panic("error cause should not be set if nil") |
| 26 | } |
| 27 | if e.cause != nil { |
| 28 | panic("error cause should not be overwritten, you're probably doing the a.WithCause(b) the wrong way around") |
| 29 | } |
| 30 | if ttnErr, ok := From(cause); ok { |
| 31 | e.cause = ttnErr |
| 32 | } else { |
| 33 | e.cause = cause |
| 34 | } |
| 35 | e.stack = callers(4) |
| 36 | e.clearGRPCStatus() |
| 37 | } |
| 38 | |
| 39 | // WithCause returns the error with the given cause set. |
| 40 | // Overwriting an existing cause in the Error will cause a panic. |
no test coverage detected