From 9abb4b654dbeff4f00410bf07e41960bd6929050 Mon Sep 17 00:00:00 2001 From: ItzCrazyKns Date: Tue, 30 Jul 2024 10:07:28 +0530 Subject: [PATCH] feat(app): handle unhandled exception & rejection --- src/app.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/app.ts b/src/app.ts index b8c2371..9c80baa 100644 --- a/src/app.ts +++ b/src/app.ts @@ -28,3 +28,11 @@ server.listen(port, () => { }); startWebSocketServer(server); + +process.on('uncaughtException', (err, origin) => { + logger.error(`Uncaught Exception at ${origin}: ${err}`) +}) + +process.on('unhandledRejection', (reason, promise) => { + logger.error(`Unhandled Rejection at: ${promise}, reason: ${reason}`) +}) \ No newline at end of file