Skip to content

Instantly share code, notes, and snippets.

@ryanwilliamquinn
Created December 17, 2014 05:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanwilliamquinn/434d6d5d0f921618af08 to your computer and use it in GitHub Desktop.
Save ryanwilliamquinn/434d6d5d0f921618af08 to your computer and use it in GitHub Desktop.
error catching machine
var BPromise = require('bluebird');
BPromise.try(function () {
console.log(1);
console.log(x.y);
console.log(2);
}).catch(function (err) {
console.log('caught an error with try', err);
});
new BPromise(function (resolve) {
console.log(1);
console.log(x.y);
console.log(2);
resolve('wtf');
}).catch(function (err) {
console.log('caught an error without try', err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment