fix: check to ensure error is something other than ErrRecordNotFound, or that exists is true
This commit is contained in:
parent
9e52d35d2f
commit
9ea77fb5c3
|
@ -280,11 +280,7 @@ func (s AccountServiceDefault) UpdateAccountName(userId uint, firstName string,
|
|||
|
||||
func (s AccountServiceDefault) UpdateAccountEmail(userId uint, email string, password string) error {
|
||||
exists, _, err := s.EmailExists(email)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if exists {
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) || exists {
|
||||
return NewAccountError(ErrKeyEmailAlreadyExists, nil)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue