MCPcopy Create free account
hub / github.com/erpc/erpc / HasErrorCode

Function HasErrorCode

common/errors.go:2335–2361  ·  view source on GitHub ↗
(err error, codes ...ErrorCode)

Source from the content-addressed store, hash-verified

2333}
2334
2335func HasErrorCode(err error, codes ...ErrorCode) bool {
2336 if err == nil {
2337 return false
2338 }
2339
2340 if be, ok := err.(StandardError); ok {
2341 return be.HasCode(codes...)
2342 }
2343
2344 if be, ok := err.(*BaseError); ok {
2345 for _, code := range codes {
2346 if be.Code == code {
2347 return true
2348 }
2349 }
2350 }
2351
2352 if arr, ok := err.(interface{ Unwrap() []error }); ok {
2353 for _, e := range arr.Unwrap() {
2354 if HasErrorCode(e, codes...) {
2355 return true
2356 }
2357 }
2358 }
2359
2360 return false
2361}
2362
2363// IsRetryableTowardNetwork reports whether err should be retried at network
2364// scope (i.e. against a different upstream). Returns true by default; returns

Callers 15

wrapTimeoutMethod · 0.92
shouldRetryMethod · 0.92
runHedgeMethod · 0.92
upstreamBreakerOutcomeFunction · 0.92
classifyUpstreamOutcomeFunction · 0.92
ForwardMethod · 0.92
AuthenticateMethod · 0.92
getWithRetriesMethod · 0.92
getCurrentValueMethod · 0.92
TestMemoryConnector_TTLFunction · 0.92

Calls 2

HasCodeMethod · 0.65
UnwrapMethod · 0.45