In my NodeJS app, whenever it encounters an unhandled exception, I want the process to exit.
However, it seems like according to NodeJS's docs, it does exit by default. So my question is - should I have something like this in my code?
process
.on('uncaughtException', (err) => {
log.error('uncaughtException:', err.message);
log.error(err.stack);
process.exit(1);
});
or should I leave the process.exit(1)
part out of it because it's not needed?