implement Is for ErrList

This commit is contained in:
e1732a364fed
2000-01-01 00:00:00 +00:00
parent 181615cfab
commit c455d34789

View File

@@ -177,3 +177,18 @@ func (e ErrList) String() string {
func (e ErrList) Error() string {
return e.String()
}
func (e ErrList) Is(target error) bool {
for _, ee := range e.List {
if ee.E == nil {
continue
}
if ee.E == target {
return true
} else if errors.Is(ee.E, target) {
return true
}
}
return false
}