Skip to content

Commit

Permalink
fix(expressLoader): log errors above status 400 (#578)
Browse files Browse the repository at this point in the history
  • Loading branch information
guidojw authored Sep 7, 2024
1 parent e2487af commit 774de35
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/loaders/express.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export default function init (container: Container): Application {
})

if (typeof process.env.SENTRY_DSN !== 'undefined') {
app.use(Sentry.Handlers.errorHandler() as ErrorRequestHandler)
app.use(Sentry.Handlers.errorHandler({
shouldHandleError: (err: any) => err.status >= 400
}) as ErrorRequestHandler)
}

app.use((err: any, _req: Request, res: Response, _next: NextFunction) => {
Expand Down

0 comments on commit 774de35

Please sign in to comment.