1
0
mirror of https://github.com/snobu/destreamer.git synced 2026-01-21 15:32:16 +00:00

process.exit on uncaught exceptions

This commit is contained in:
Luca Armaroli
2020-09-24 02:30:49 +02:00
parent 14cfe7c18e
commit c7e0415786

View File

@@ -24,6 +24,11 @@ export function setProcessEvents(): void {
process.exit(777);
});
process.on('uncaughtException', (err: Error) => {
logger.error(err);
process.exit(ERROR_CODE.UNHANDLED_ERROR);
});
process.on('unhandledRejection', (reason: {} | null | undefined) => {
if (reason instanceof Error) {
logger.error({ message: (reason as Error) });