blob: 92f3b5b61f855aaa1f783607685e761fee1b2b23 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
//go:build !go1.20
// +build !go1.20
package errs
// Is checks if any of the underlying errors matches target
func Is(err, target error) bool {
return IsFunc(err, func(err error) bool {
if err == target {
return true
}
if x, ok := err.(interface{ Is(error) bool }); ok && x.Is(target) {
return true
}
return false
})
}
|