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{})
| 2038 | // NotErrorIs asserts that at none of the errors in err's chain matches target. |
| 2039 | // This is a wrapper for errors.Is. |
| 2040 | func 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. |
searching dependent graphs…