Skip to content

Commit 1a5997a

Browse files
committed
Refactor: changed the errors.Contains function
Signed-off-by: nyagamunene <[email protected]>
1 parent 762562d commit 1a5997a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/errors/errors.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package errors
55

66
import (
77
"encoding/json"
8+
"errors"
89
)
910

1011
// Error specifies an API that must be fullfiled by error type.
@@ -80,9 +81,9 @@ func Contains(e1, e2 error) bool {
8081
if ce.Msg() == e2.Error() {
8182
return true
8283
}
83-
return Contains(ce.Err(), e2)
84+
return errors.Is(ce.Err(), e2)
8485
}
85-
return e1.Error() == e2.Error()
86+
return errors.Is(e1, e2)
8687
}
8788

8889
// Wrap returns an Error that wrap err with wrapper.

0 commit comments

Comments
 (0)