From d58214cedd66b5382b017964d21fe50afb481d1d Mon Sep 17 00:00:00 2001 From: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com> Date: Thu, 24 Oct 2024 13:08:25 +0200 Subject: [PATCH] fix: error logger catchall --- src/lib/app.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/app.ts b/src/lib/app.ts index 6de9ec9fc4..7f52e49b74 100644 --- a/src/lib/app.ts +++ b/src/lib/app.ts @@ -197,12 +197,6 @@ export default async function getApp( services.openApiService.useErrorHandler(app); } - if (process.env.NODE_ENV !== 'production') { - app.use(errorHandler()); - } else { - app.use(catchAllErrorHandler(config.getLogger)); - } - app.get(`${baseUriPath}`, (req, res) => { res.set('Content-Type', 'text/html'); res.send(indexHTML); @@ -229,5 +223,11 @@ export default async function getApp( res.send(indexHTML); }); + if (process.env.NODE_ENV !== 'production') { + app.use(errorHandler()); + } else { + app.use(catchAllErrorHandler(config.getLogger)); + } + return app; }