Skip to content

Commit 362e558

Browse files
committed
add EqualAny
1 parent 4276c97 commit 362e558

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

err.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ func NewErrorf(format string, info ...interface{}) *traceError {
2424
return TraceEx(1, fmt.Errorf(format, info...))
2525
}
2626

27+
func EqualAny(e error, es []error) bool {
28+
for i := 0; i < len(es); i++ {
29+
if Equal(e, es[i]) {
30+
return true
31+
}
32+
}
33+
return false
34+
}
35+
2736
func Equal(e1, e2 error) bool {
2837
if e, ok := e1.(*traceError); ok {
2938
e1 = e.error

0 commit comments

Comments
 (0)