feat(database): improve error handling (#1633)

This commit is contained in:
ze0s 2024-08-29 09:00:53 +02:00 committed by GitHub
parent cc0cca9f0d
commit accc875960
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 56 additions and 44 deletions

View file

@ -157,7 +157,7 @@ func TestDownloadClientRepo_FindByID(t *testing.T) {
t.Run(fmt.Sprintf("FindByID_Fails_With_Nonexistent_ID [%s]", dbType), func(t *testing.T) {
_, err := repo.FindByID(context.Background(), 9999)
assert.Error(t, err)
assert.Equal(t, "no client configured", err.Error())
assert.ErrorIs(t, err, domain.ErrRecordNotFound)
})
t.Run(fmt.Sprintf("FindByID_Fails_With_Negative_ID [%s]", dbType), func(t *testing.T) {
@ -179,7 +179,7 @@ func TestDownloadClientRepo_FindByID(t *testing.T) {
_ = repo.Delete(context.Background(), mock.ID)
_, err := repo.FindByID(context.Background(), mock.ID)
assert.Error(t, err)
assert.Equal(t, "no client configured", err.Error())
assert.ErrorIs(t, err, domain.ErrRecordNotFound)
// Cleanup
_ = repo.Delete(context.Background(), mock.ID)