MCPcopy
hub / github.com/pkg/errors / Cause

Function Cause

errors.go:275–288  ·  view source on GitHub ↗

Cause returns the underlying cause of the error, if possible. An error value has a cause if it implements the following interface: type causer interface { Cause() error } If the error does not implement Cause, the original error will be returned. If the error is nil, nil will be returned without f

(err error)

Source from the content-addressed store, hash-verified

273// be returned. If the error is nil, nil will be returned without further
274// investigation.
275func Cause(err error) error {
276 type causer interface {
277 Cause() error
278 }
279
280 for err != nil {
281 cause, ok := err.(causer)
282 if !ok {
283 break
284 }
285 err = cause.Cause()
286 }
287 return err
288}

Callers 2

TestCauseFunction · 0.85
TestStackTraceFunction · 0.85

Calls 1

CauseMethod · 0.65

Tested by 2

TestCauseFunction · 0.68
TestStackTraceFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…