Skip to content

Commit

Permalink
Merge pull request #188 from companieshouse/IDVA5-1887-Wrong-error-sc…
Browse files Browse the repository at this point in the history
…reen-on-idle

Moving the error handling above unhandled errors, allowing it to be called
  • Loading branch information
ttingle-ch authored Feb 28, 2025
2 parents 97a9b07 + 6e7634c commit 5793a73
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ app.use((req: Request, res: Response, next: NextFunction) => {
// Channel all requests through router dispatch
routerDispatch(app);

app.use(...errorHandler);

// Unhandled errors
app.use((err: any, req: Request, res: Response, next: NextFunction) => {
logger.error(`${err.name} - appError: ${err.message} - ${err.stack}`);
const errorService = new ErrorService();
errorService.renderErrorPage(res, getLocalesService(), selectLang(req.query.lang), req.url);
});

app.use(...errorHandler);

// Unhandled exceptions
process.on("uncaughtException", (err: any) => {
logger.error(`${err.name} - uncaughtException: ${err.message} - ${err.stack}`);
Expand Down

0 comments on commit 5793a73

Please sign in to comment.