Commit 35c67606 by Arve Knudsen Committed by GitHub

Chore: Use errors.Is for comparing errors (#26719)

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
parent 16c185c3
...@@ -42,7 +42,7 @@ func (ls *LoginService) UpsertUser(cmd *models.UpsertUserCommand) error { ...@@ -42,7 +42,7 @@ func (ls *LoginService) UpsertUser(cmd *models.UpsertUserCommand) error {
} }
if err := bus.Dispatch(userQuery); err != nil { if err := bus.Dispatch(userQuery); err != nil {
if err != models.ErrUserNotFound { if !errors.Is(err, models.ErrUserNotFound) {
return err return err
} }
if !cmd.SignupAllowed { if !cmd.SignupAllowed {
...@@ -114,7 +114,7 @@ func (ls *LoginService) UpsertUser(cmd *models.UpsertUserCommand) error { ...@@ -114,7 +114,7 @@ func (ls *LoginService) UpsertUser(cmd *models.UpsertUserCommand) error {
User: cmd.Result, User: cmd.Result,
ExternalUser: extUser, ExternalUser: extUser,
}) })
if err != nil && err != bus.ErrHandlerNotFound { if err != nil && !errors.Is(err, bus.ErrHandlerNotFound) {
return err return err
} }
...@@ -223,7 +223,7 @@ func syncOrgRoles(user *models.User, extUser *models.ExternalUserInfo) error { ...@@ -223,7 +223,7 @@ func syncOrgRoles(user *models.User, extUser *models.ExternalUserInfo) error {
// add role // add role
cmd := &models.AddOrgUserCommand{UserId: user.Id, Role: orgRole, OrgId: orgId} cmd := &models.AddOrgUserCommand{UserId: user.Id, Role: orgRole, OrgId: orgId}
err := bus.Dispatch(cmd) err := bus.Dispatch(cmd)
if err != nil && err != models.ErrOrgNotFound { if err != nil && !errors.Is(err, models.ErrOrgNotFound) {
return err return err
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment