feat: add errorx.In to facility error checking (#4105)

This commit is contained in:
Kevin Wan
2024-04-27 20:43:45 +08:00
committed by GitHub
parent b337ae36e5
commit bfddb9dae4
7 changed files with 97 additions and 22 deletions

14
core/errorx/check.go Normal file
View File

@@ -0,0 +1,14 @@
package errorx
import "errors"
// In checks if the given err is one of errs.
func In(err error, errs ...error) bool {
for _, each := range errs {
if errors.Is(err, each) {
return true
}
}
return false
}