Last active
November 25, 2019 19:08
-
-
Save adg29/510a18f0c6ba47264fdfbd017f4e3fa7 to your computer and use it in GitHub Desktop.
unhandledRejection event on process object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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