MCPcopy
hub / github.com/stretchr/testify / ErrorAsf

Function ErrorAsf

assert/assertion_format.go:140–145  ·  view source on GitHub ↗

ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. This is a wrapper for errors.As.

(t TestingT, err error, target interface{}, msg string, args ...interface{})

Source from the content-addressed store, hash-verified

138// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
139// This is a wrapper for errors.As.
140func ErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) bool {
141 if h, ok := t.(tHelper); ok {
142 h.Helper()
143 }
144 return ErrorAs(t, err, target, append([]interface{}{msg}, args...)...)
145}
146
147// ErrorContainsf asserts that a function returned an error (i.e. not `nil`)
148// and that the error contains the specified substring.

Callers 2

ErrorAsfFunction · 0.92
ErrorAsfMethod · 0.70

Calls 2

ErrorAsFunction · 0.70
HelperMethod · 0.65

Tested by

no test coverage detected