From c0be7550db84f323e036925a3ec45cbf0b5b8d93 Mon Sep 17 00:00:00 2001 From: MarkNjunge Date: Sun, 2 Jun 2024 17:21:13 +0300 Subject: [PATCH] Catch uncaught exceptions --- src/main.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main.ts b/src/main.ts index 5819286..e66bda0 100644 --- a/src/main.ts +++ b/src/main.ts @@ -91,6 +91,10 @@ async function enablePlugins(app: NestFastifyApplication): Promise { }); } +process.on("uncaughtException", (e, origin) => { + logger.error(`${origin}: ${e.message}`, {}, e); +}); + function initializeSwagger(app: NestFastifyApplication): void { if (!bool(config.swagger.enabled)) { return;