make Is() interop with pkg/errors
This commit is contained in:
parent
825e9a1235
commit
dd131cce3d
1 changed files with 7 additions and 0 deletions
|
@ -42,7 +42,14 @@ func Wrap(err interface{}, skip int) *errors.Error {
|
|||
}
|
||||
|
||||
// Is compares two wrapped errors to determine if the underlying errors are the same
|
||||
// It also interops with errors from pkg/errors
|
||||
func Is(e error, original error) bool {
|
||||
if c, ok := e.(causer); ok {
|
||||
e = c.Cause()
|
||||
}
|
||||
if c, ok := original.(causer); ok {
|
||||
original = c.Cause()
|
||||
}
|
||||
return errors.Is(e, original)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue