Skip to content

Commit

Permalink
bskyogcard: fix some express plumbing
Browse files Browse the repository at this point in the history
  • Loading branch information
devinivy committed Jun 20, 2024
1 parent fab409a commit f907aa5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions bskyogcard/src/routes/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export const handler = (runHandler: Handler): RequestHandler => {
return async (req, res, next) => {
try {
await runHandler(req, res)
next()
} catch (err) {
next(err)
}
Expand All @@ -30,8 +29,8 @@ export function originVerifyMiddleware(ctx: AppContext): RequestHandler {

export const errorHandler: ErrorRequestHandler = (err, req, res, next) => {
httpLogger.error({err}, 'request error')
if (!res.headersSent) {
res.status(500).end('server error')
if (res.headersSent) {
return next(err)
}
return next()
return res.status(500).end('server error')
}

0 comments on commit f907aa5

Please sign in to comment.