MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / setCause

Method setCause

pkg/errors/causes.go:23–37  ·  view source on GitHub ↗
(cause error)

Source from the content-addressed store, hash-verified

21}
22
23func (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.

Callers 2

WithCauseMethod · 0.80
WithCauseMethod · 0.80

Calls 3

clearGRPCStatusMethod · 0.95
FromFunction · 0.85
callersFunction · 0.85

Tested by

no test coverage detected