Skip to content

Commit

Permalink
Error util to check one of. (#815)
Browse files Browse the repository at this point in the history
  • Loading branch information
boks1971 committed Sep 19, 2024
1 parent cbf7678 commit c7283a4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions utils/error.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package utils

import "errors"

func ErrorIsOneOf(err error, targets ...error) bool {
for _, t := range targets {
if errors.Is(err, t) {
return true
}
}
return false
}

0 comments on commit c7283a4

Please sign in to comment.