MCPcopy Index your code
hub / github.com/cockroachdb/errors / As

Function As

errutil_api.go:202–202  ·  view source on GitHub ↗

As finds the first error in err's chain that matches the type to which target points, and if so, sets the target to its value and returns true. An error matches a type if it is assignable to the target type, or if it has a method As(interface{}) bool such that As(target) returns true. As will panic

(err error, target interface{})

Source from the content-addressed store, hash-verified

200// - it also supports recursing through causes with Cause().
201// - if it detects an API use error, its panic object is a valid error.
202func As(err error, target interface{}) bool { return errutil.As(err, target) }
203
204// Join returns an error that wraps the given errors.
205// Any nil error values are discarded.

Callers 4

IsPermissionFunction · 0.92
IsExistFunction · 0.92
IsNotExistFunction · 0.92
TestAsFunction · 0.92

Calls 1

AsFunction · 0.92

Tested by 1

TestAsFunction · 0.74