Skip to content

Commit

Permalink
Re-enable the default express exception handler
Browse files Browse the repository at this point in the history
  • Loading branch information
n1kPLV committed Sep 7, 2023
1 parent f608493 commit 92e2d0d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Server/src/utils/please_dont_crash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import { logger } from "./logger"
export default function please_dont_crash(cb: (req: Request, res: Response, next: NextFunction) => Promise<void>) {
return (req: Request, res: Response, next: NextFunction) =>
cb(req, res, next).catch(err => {
// log the error
logger.error(err)
next()
// and give that error to the next expressjs error handler
next(err)
})
}

0 comments on commit 92e2d0d

Please sign in to comment.