MCPcopy
hub / github.com/larksuite/cli / UnwrapTypedError

Function UnwrapTypedError

errs/predicates.go:30–38  ·  view source on GitHub ↗

UnwrapTypedError walks the wrap chain and returns the first error that embeds Problem (i.e. any typed error in this package). Returns the typed error itself (as error) so callers — notably JSON marshaling — see the concrete value's own struct tags rather than an opaque wrapper.

(err error)

Source from the content-addressed store, hash-verified

28// error itself (as error) so callers — notably JSON marshaling — see the
29// concrete value's own struct tags rather than an opaque wrapper.
30func UnwrapTypedError(err error) (error, bool) {
31 var c problemCarrier
32 if errors.As(err, &c) {
33 if e, ok := c.(error); ok {
34 return e, true
35 }
36 }
37 return nil, false
38}
39
40// CategoryOf returns the error's Category for metrics/logging/dispatch routing.
41// Falls back to CategoryInternal for non-typed errors.

Callers 4

WriteTypedErrorEnvelopeFunction · 0.92
gitCredentialLocalErrorFunction · 0.92
emitDraftSendAbortedFunction · 0.92

Calls 1

AsMethod · 0.80

Tested by 1