From f907aa5548c42fba478cd8da79dfa1df3c44233a Mon Sep 17 00:00:00 2001 From: Devin Ivy Date: Thu, 20 Jun 2024 01:16:07 -0400 Subject: [PATCH] bskyogcard: fix some express plumbing --- bskyogcard/src/routes/util.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bskyogcard/src/routes/util.ts b/bskyogcard/src/routes/util.ts index af51318e4a..718ed592a1 100644 --- a/bskyogcard/src/routes/util.ts +++ b/bskyogcard/src/routes/util.ts @@ -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) } @@ -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') }