nvidia-container-toolkit/vendor/github.com/tsaikd/KDGoLib/errutil/util.go
Evan Lezar 6e1436cefb Update go vendoring
Signed-off-by: Evan Lezar <elezar@nvidia.com>
2021-09-07 13:13:03 +02:00

20 lines
446 B
Go

package errutil
// ContainErrorFunc check error contain error by custom equalFunc
func ContainErrorFunc(err error, equalFunc func(error) bool) bool {
errobj := castErrorObject(nil, 1, err)
contain := false
if walkerr := WalkErrors(errobj, func(errcomp ErrorObject) (stop bool, walkerr error) {
if equalFunc(errcomp) {
contain = true
return true, nil
}
return false, nil
}); walkerr != nil {
return false
}
return contain
}