Skip to content

Instantly share code, notes, and snippets.

@andreiashu
Created May 24, 2017 22:23
Show Gist options
  • Save andreiashu/c90f6e5bb26f4245ffcfa3f855d76b85 to your computer and use it in GitHub Desktop.
Save andreiashu/c90f6e5bb26f4245ffcfa3f855d76b85 to your computer and use it in GitHub Desktop.
bluebird handling unhandled rejections
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