Skip to content

Commit

Permalink
fix: fixed error handling in persister
Browse files Browse the repository at this point in the history
  • Loading branch information
mitar authored Nov 16, 2021
1 parent ef11adf commit 3b4f200
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions persistence/sql/persister_oauth2.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,9 @@ func (p *Persister) FlushInactiveAccessTokens(ctx context.Context, notAfter time
notAfter,
)
if err := q.All(&signatures); err == sql.ErrNoRows {
return errors.Wrap(fosite.ErrNotFound, "")
return errorsx.WithStack(fosite.ErrNotFound)
} else if err != nil {
return errorsx.WithStack(err)
}

// Delete tokens in batch
Expand Down Expand Up @@ -416,7 +418,9 @@ func (p *Persister) FlushInactiveRefreshTokens(ctx context.Context, notAfter tim
notAfter,
)
if err := q.All(&signatures); err == sql.ErrNoRows {
return errors.Wrap(fosite.ErrNotFound, "")
return errorsx.WithStack(fosite.ErrNotFound)
} else if err != nil {
return errorsx.WithStack(err)
}

// Delete tokens in batch
Expand Down

0 comments on commit 3b4f200

Please sign in to comment.