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

Function ErrorIs

internal/testify/assert/assertions.go:2017–2036  ·  view source on GitHub ↗

ErrorIs asserts that at least one 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

2015// ErrorIs asserts that at least one of the errors in err's chain matches target.
2016// This is a wrapper for errors.Is.
2017func ErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool {
2018 if h, ok := t.(tHelper); ok {
2019 h.Helper()
2020 }
2021 if errors.Is(err, target) {
2022 return true
2023 }
2024
2025 var expectedText string
2026 if target != nil {
2027 expectedText = target.Error()
2028 }
2029
2030 chain := buildErrorChainString(err)
2031
2032 return Fail(t, fmt.Sprintf("Target error should be in err chain:\n"+
2033 "expected: %q\n"+
2034 "in chain: %s", expectedText, chain,
2035 ), msgAndArgs...)
2036}
2037
2038// NotErrorIs asserts that at none of the errors in err's chain matches target.
2039// This is a wrapper for errors.Is.

Callers 4

ErrorIsFunction · 0.92
ErrorIsfFunction · 0.70
TestErrorIsFunction · 0.70
ErrorIsMethod · 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

TestErrorIsFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…