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

Function ProblemOf

errs/predicates.go:16–24  ·  view source on GitHub ↗

ProblemOf extracts the embedded Problem via the non-exported problemCarrier interface. This is the supported way to read shared fields without depending on a specific typed error. A typed error whose embedded *Problem is nil is treated as "not a problem carrier" — returning (nil, true) here would c

(err error)

Source from the content-addressed store, hash-verified

14// carrier" — returning (nil, true) here would cause CategoryOf / IsRetryable
15// and other downstream readers to dereference nil.
16func ProblemOf(err error) (*Problem, bool) {
17 var c problemCarrier
18 if errors.As(err, &c) {
19 if p := c.ProblemDetail(); p != nil {
20 return p, true
21 }
22 }
23 return nil, false
24}
25
26// UnwrapTypedError walks the wrap chain and returns the first error that
27// embeds Problem (i.e. any typed error in this package). Returns the typed

Calls 2

ProblemDetailMethod · 0.95
AsMethod · 0.80