MCPcopy
hub / github.com/gofiber/fiber / asFiberError

Function asFiberError

app.go:644–655  ·  view source on GitHub ↗

asFiberError reports whether err is or wraps a *Error and returns it. A direct *Error is matched alloc-free by a type assertion; wrapped or joined errors fall back to errors.As.

(err error)

Source from the content-addressed store, hash-verified

642// *Error is matched alloc-free by a type assertion; wrapped or joined errors
643// fall back to errors.As.
644func asFiberError(err error) (*Error, bool) {
645 if err == nil {
646 return nil, false
647 }
648 if e, ok := err.(*Error); ok { //nolint:errorlint // intentional fast path; wrapped/joined errors fall through to errors.As below
649 return e, true
650 }
651 // Declared here so errors.As's &target escapes only on this slow path.
652 var target *Error
653 matched := errors.As(err, &target)
654 return target, matched
655}
656
657// New creates a new Fiber named instance.
658//

Callers 1

DefaultErrorHandlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected