diff --git a/bootstrap/postgres/configs.go b/bootstrap/postgres/configs.go index 73b3130b1..09d0b90e3 100644 --- a/bootstrap/postgres/configs.go +++ b/bootstrap/postgres/configs.go @@ -100,15 +100,11 @@ func (cr configRepository) RetrieveByID(ctx context.Context, domainID, id string } row, err := cr.db.NamedQueryContext(ctx, q, dbcfg) if err != nil { - if err == sql.ErrNoRows { - return bootstrap.Config{}, errors.Wrap(repoerr.ErrNotFound, err) - } - return bootstrap.Config{}, errors.Wrap(repoerr.ErrViewEntity, err) } - if ok := row.Next(); !ok { - return bootstrap.Config{}, errors.Wrap(repoerr.ErrNotFound, row.Err()) + if !row.Next() { + return bootstrap.Config{}, errors.Wrap(repoerr.ErrNotFound, sql.ErrNoRows) } if err := row.StructScan(&dbcfg); err != nil { @@ -211,8 +207,8 @@ func (cr configRepository) RetrieveByExternalID(ctx context.Context, externalID return bootstrap.Config{}, errors.Wrap(repoerr.ErrViewEntity, err) } - if ok := row.Next(); !ok { - return bootstrap.Config{}, errors.Wrap(repoerr.ErrNotFound, row.Err()) + if !row.Next() { + return bootstrap.Config{}, errors.Wrap(repoerr.ErrNotFound, sql.ErrNoRows) } if err := row.StructScan(&dbcfg); err != nil {