Cause returns the cause of the given error, if any.
(err error)
| 70 | |
| 71 | // Cause returns the cause of the given error, if any. |
| 72 | func Cause(err error) error { |
| 73 | if causeErr := (causer)(nil); errors.As(err, &causeErr) { |
| 74 | return causeErr.Cause() |
| 75 | } |
| 76 | return nil |
| 77 | } |
| 78 | |
| 79 | // RootCause walks up the "error chain" until it finds the root cause of an error. |
| 80 | func RootCause(err error) error { |