AppError UnhandledRejection _ UncaughtException

karakib2k18

Kazi Abdur Rakib

Posted on December 18, 2023

AppError UnhandledRejection _ UncaughtException
///src/app.ts
const test = async (req: Request, res: Response) => {
  Promise.reject();
  // res.send('Hello PH UNIVERSTIY');
};

Enter fullscreen mode Exit fullscreen mode
//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);
});
Enter fullscreen mode Exit fullscreen mode
๐Ÿ’– ๐Ÿ’ช ๐Ÿ™… ๐Ÿšฉ
karakib2k18
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.

Related

ยฉ TheLazy.dev

About