Skip to content

Commit

Permalink
Refactor: changed the errors.Contains function
Browse files Browse the repository at this point in the history
Signed-off-by: nyagamunene <[email protected]>
  • Loading branch information
nyagamunene committed Jun 12, 2024
1 parent 762562d commit 1a5997a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package errors

import (
"encoding/json"
"errors"
)

// Error specifies an API that must be fullfiled by error type.
Expand Down Expand Up @@ -80,9 +81,9 @@ func Contains(e1, e2 error) bool {
if ce.Msg() == e2.Error() {
return true
}
return Contains(ce.Err(), e2)
return errors.Is(ce.Err(), e2)
}
return e1.Error() == e2.Error()
return errors.Is(e1, e2)
}

// Wrap returns an Error that wrap err with wrapper.
Expand Down

0 comments on commit 1a5997a

Please sign in to comment.