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

@@ -192,7 +192,7 @@ func (s Service) getFromRepo(ctx context.Context, id string) (*pb.Group, error)
}
g, m, err := repo.LookupGroup(ctx, id)
if err != nil {
if errors.Is(err, errors.ErrRecordNotFound) {
if errors.IsNotFoundError(err) {
return nil, handlers.NotFoundErrorf("Group %q doesn't exist.", id)
}
return nil, fmt.Errorf("unable to get group: %w", err)
@@ -268,7 +268,7 @@ func (s Service) deleteFromRepo(ctx context.Context, id string) (bool, error) {
}
rows, err := repo.DeleteGroup(ctx, id)
if err != nil {
if errors.Is(err, errors.ErrRecordNotFound) {
if errors.IsNotFoundError(err) {
return false, nil
}
return false, fmt.Errorf("unable to delete group: %w", err)