For unhandled exceptions:
Here uncaughtException event listener will be called for every such scenario.
Source: here
For unhandled Promise rejection:
process.on('unhandledRejection', err => { console.error('There was an uncaught error', err) process.exit(1) //mandatory (as per the Node.js docs) })
Here unhandledRejection event listener will also be called for every such scenario.
process.on('uncaughtException', err => { console.error('There was an uncaught error', err) process.exit(1) //mandatory (as per the Node.js docs) })
Here uncaughtException event listener will be called for every such scenario.
Source: here
For unhandled Promise rejection:
process.on('unhandledRejection', err => { console.error('There was an uncaught error', err) process.exit(1) //mandatory (as per the Node.js docs) })
Here unhandledRejection event listener will also be called for every such scenario.