Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MG-2059 - Set correct log level depending on error #2196

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor: changed the errors.Contains function
Signed-off-by: nyagamunene <[email protected]>
nyagamunene committed Jun 12, 2024
commit 13d7c6f0f763a6ef525948ac9e0e1731ac0d2bcb
5 changes: 3 additions & 2 deletions pkg/errors/errors.go
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ package errors

import (
"encoding/json"
"errors"
)

// Error specifies an API that must be fullfiled by error type.
@@ -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.