MCPcopy
hub / github.com/pkg/errors / As

Function As

go113.go:31–31  ·  view source on GitHub ↗

As finds the first error in err's chain that matches target, and if so, sets target to that error value and returns true. The chain consists of err itself followed by the sequence of errors obtained by repeatedly calling Unwrap. An error matches target if the error's concrete value is assignable t

(err error, target interface{})

Source from the content-addressed store, hash-verified

29// As will panic if target is not a non-nil pointer to either a type that implements
30// error, or to any interface type. As returns false if err is nil.
31func As(err error, target interface{}) bool { return stderrors.As(err, target) }
32
33// Unwrap returns the result of calling the Unwrap method on err, if err's
34// type contains an Unwrap method returning error.

Callers 1

TestAsFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestAsFunction · 0.68