ICU-738/Refactor internal/db to domain errors (#815)

* Refactor internal/db to domain errors
This commit is contained in:
Louis Ruch authored and GitHub committed 2020-12-21 10:07:34 -08:00
1 parent b5d84495a3
commit bfbb179741
82 files changed
+742 -640

No files matched your search

@@ -178,7 +178,7 @@ func (s Service) getFromRepo(ctx context.Context, id string) (*pb.AuthMethod, er
}
u, err := repo.LookupAuthMethod(ctx, id)
if err != nil {
if errors.Is(err, errors.ErrRecordNotFound) {
if errors.IsNotFoundError(err) {
return nil, handlers.NotFoundErrorf("AuthMethod %q doesn't exist.", id)
}
return nil, err
@@ -287,7 +287,7 @@ func (s Service) deleteFromRepo(ctx context.Context, scopeId, id string) (bool,
}
rows, err := repo.DeleteAuthMethod(ctx, scopeId, id)
if err != nil {
if errors.Is(err, errors.ErrRecordNotFound) {
if errors.IsNotFoundError(err) {
return false, nil
}
return false, fmt.Errorf("unable to delete auth method: %w", err)