MCPcopy
hub / github.com/expr-lang/expr / ErrorAsf

Function ErrorAsf

internal/testify/require/require.go:311–319  ·  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

309// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
310// This is a wrapper for errors.As.
311func ErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) {
312 if h, ok := t.(tHelper); ok {
313 h.Helper()
314 }
315 if assert.ErrorAsf(t, err, target, msg, args...) {
316 return
317 }
318 t.FailNow()
319}
320
321// ErrorContains asserts that a function returned an error (i.e. not `nil`)
322// and that the error contains the specified substring.

Callers 1

ErrorAsfMethod · 0.70

Calls 3

ErrorAsfFunction · 0.92
FailNowMethod · 0.65
HelperMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…