Skip to content

Instantly share code, notes, and snippets.

@adg29
Last active November 25, 2019 19:08
Show Gist options
  • Save adg29/510a18f0c6ba47264fdfbd017f4e3fa7 to your computer and use it in GitHub Desktop.
Save adg29/510a18f0c6ba47264fdfbd017f4e3fa7 to your computer and use it in GitHub Desktop.
unhandledRejection event on process object
process.on('unhandledRejection', (reason, promise) => {
console.log(`Unhandled rejection at ${promise}`)
console.log(`Message ${reason}`)
})
const willThrowErrors = async () => {
return new Promise(function shouldBeCaught(resolve, reject) {
reject(`I should be caught and handled with!`)
})
}
willThrowErrors()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment