chore: update error names

This commit is contained in:
2024-09-27 11:22:32 +02:00
committed by Tim Wundenberg
parent 7e8730206c
commit 5d479b0811
5 changed files with 15 additions and 14 deletions

View File

@@ -11,7 +11,7 @@ import (
)
var (
UserNotFound = errors.New("User not found")
ErrUserNotFound = errors.New("User not found")
)
type User struct {
@@ -67,10 +67,10 @@ func (db DbAuthSqlite) GetUser(email string) (*User, error) {
WHERE email = ?`, email).Scan(&userId, &emailVerified, &emailVerifiedAt, &password, &salt, &createdAt)
if err != nil {
if err == sql.ErrNoRows {
return nil, UserNotFound
return nil, ErrUserNotFound
} else {
utils.LogError("SQL error GetUser", err)
return nil, types.InternalServerError
return nil, types.ErrInternal
}
}

View File

@@ -32,7 +32,7 @@ func TestGetUser(t *testing.T) {
underTest := DbAuthSqlite{db: db}
_, err := underTest.GetUser("someNonExistentEmail")
if err != UserNotFound {
if err != ErrUserNotFound {
t.Errorf("Expected UserNotFound, got %v", err)
}
})