NotErrorAs asserts that none of the errors in err's chain matches target, but if so, sets target to that error value.
(t TestingT, err error, target interface{}, msgAndArgs ...interface{})
| 2243 | // NotErrorAs asserts that none of the errors in err's chain matches target, |
| 2244 | // but if so, sets target to that error value. |
| 2245 | func NotErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) bool { |
| 2246 | if h, ok := t.(tHelper); ok { |
| 2247 | h.Helper() |
| 2248 | } |
| 2249 | if !errors.As(err, target) { |
| 2250 | return true |
| 2251 | } |
| 2252 | |
| 2253 | chain := buildErrorChainString(err, true) |
| 2254 | |
| 2255 | return Fail(t, fmt.Sprintf("Target error should not be in err chain:\n"+ |
| 2256 | "found: %s\n"+ |
| 2257 | "in chain: %s", reflect.TypeOf(target).Elem().String(), chain, |
| 2258 | ), msgAndArgs...) |
| 2259 | } |
| 2260 | |
| 2261 | func unwrapAll(err error) (errs []error) { |
| 2262 | errs = append(errs, err) |