AppError UnhandledRejection _ UncaughtException
Kazi Abdur Rakib
Posted on December 18, 2023
///src/app.ts
const test = async (req: Request, res: Response) => {
Promise.reject();
// res.send('Hello PH UNIVERSTIY');
};
//src/server.ts
process.on('unhandledRejection', () => {
console.log(`๐ unahandledRejection is detected , shutting down ...`);
if (server) {
server.close(() => {
process.exit(1);
});
}
process.exit(1);
});
process.on('uncaughtException', () => {
console.log(`๐ uncaughtException is detected , shutting down ...`);
process.exit(1);
});
๐ ๐ช ๐
๐ฉ
Kazi Abdur Rakib
Posted on December 18, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.