Created
May 24, 2017 22:23
-
-
Save andreiashu/c90f6e5bb26f4245ffcfa3f855d76b85 to your computer and use it in GitHub Desktop.
bluebird handling unhandled rejections
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
const Promise = require('bluebird'); | |
// bluebird unhandledRejection event | |
process.on('unhandledRejection', function (reason, promise) { | |
console.log(`unhandledRejection, reason ${reason}`, promise); | |
// don't continue in this state you plonker! | |
process.exit(1); | |
}); | |
new Promise(function(resolve, reject) { | |
reject(new Error('Something bad happened here...')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment