Skip to content

Commit

Permalink
fix: set the status to 5xx if an unexpected error happens
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Marbach committed Apr 1, 2020
1 parent e422866 commit 704c410
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ function configureMiddleware(
export function configureErrorMiddleware(app: Application) {
app.use((err: Error, _req: Request, res: Response, _next: NextFunction) => {
if (err instanceof StatusCodeError) res.status(err.statusCode);
else res.status(500);
res.send(err.message);
});
}
Expand Down

0 comments on commit 704c410

Please sign in to comment.