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

Function ErrorAsf

require/require.go:326–334  ·  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

324// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
325// This is a wrapper for errors.As.
326func ErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) {
327 if h, ok := t.(tHelper); ok {
328 h.Helper()
329 }
330 if assert.ErrorAsf(t, err, target, msg, args...) {
331 return
332 }
333 t.FailNow()
334}
335
336// ErrorContains asserts that a function returned an error (i.e. not `nil`)
337// and that the error contains the specified substring.

Callers 1

ErrorAsfMethod · 0.70

Calls 3

ErrorAsfFunction · 0.92
HelperMethod · 0.65
FailNowMethod · 0.65

Tested by

no test coverage detected