Cause returns the cause of the given error. This will be either the original error, or the result of a Wrap or Mask call. Cause is the usual way to diagnose errors that may have been wrapped by the other errors functions.
(err error)
| 201 | // Cause is the usual way to diagnose errors that may have been wrapped by |
| 202 | // the other errors functions. |
| 203 | func Cause(err error) error { |
| 204 | var diag error |
| 205 | if err, ok := err.(causer); ok { |
| 206 | diag = err.Cause() |
| 207 | } |
| 208 | if diag != nil { |
| 209 | return diag |
| 210 | } |
| 211 | return err |
| 212 | } |
| 213 | |
| 214 | type causer interface { |
| 215 | Cause() error |
searching dependent graphs…