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

Function NotErrorIs

internal/testify/assert/assertions.go:2040–2059  ·  view source on GitHub ↗

NotErrorIs asserts that at none of the errors in err's chain matches target. This is a wrapper for errors.Is.

(t TestingT, err, target error, msgAndArgs ...interface{})

Source from the content-addressed store, hash-verified

2038// NotErrorIs asserts that at none of the errors in err's chain matches target.
2039// This is a wrapper for errors.Is.
2040func NotErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool {
2041 if h, ok := t.(tHelper); ok {
2042 h.Helper()
2043 }
2044 if !errors.Is(err, target) {
2045 return true
2046 }
2047
2048 var expectedText string
2049 if target != nil {
2050 expectedText = target.Error()
2051 }
2052
2053 chain := buildErrorChainString(err)
2054
2055 return Fail(t, fmt.Sprintf("Target error should not be in err chain:\n"+
2056 "found: %q\n"+
2057 "in chain: %s", expectedText, chain,
2058 ), msgAndArgs...)
2059}
2060
2061// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
2062// This is a wrapper for errors.As.

Callers 4

NotErrorIsFunction · 0.92
NotErrorIsfFunction · 0.70
TestNotErrorIsFunction · 0.70
NotErrorIsMethod · 0.70

Calls 6

buildErrorChainStringFunction · 0.85
IsMethod · 0.80
SprintfMethod · 0.80
FailFunction · 0.70
HelperMethod · 0.45
ErrorMethod · 0.45

Tested by 1

TestNotErrorIsFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…