How to handle the Unhandled exceptions

If any uncaught exception occurs in your code flow, that exception will be caught in code shown below:
[php]
process.on(‘uncaughtException’, function(err) {
// handle the error safely
console.log(err)
})
[/php]