Skip to content

Commit

Permalink
fix(backend): fix error catching
Browse files Browse the repository at this point in the history
  • Loading branch information
raducristianpopa committed Nov 25, 2022
1 parent 84a2e18 commit 6378e3f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/backend/src/open_payments/auth/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ export function createAuthMiddleware({
{ id: grant.grant, clientId: grant.clientId },
action
)
} catch (e) {
const errInfo = e && typeof e === 'object' && e.stack ? e.stack : e
logger.debug(errInfo)
} catch (error) {
const errorMessage =
error?.message ?? 'Failed to get or create grant reference'
logger.error({ error }, errorMessage)
ctx.throw(500)
}

Expand Down

0 comments on commit 6378e3f

Please sign in to comment.