Skip to content

Instantly share code, notes, and snippets.

@fullstackwebdev
Created November 10, 2015 05:14
Show Gist options
  • Save fullstackwebdev/dadf7e5dbba593c514e8 to your computer and use it in GitHub Desktop.
Save fullstackwebdev/dadf7e5dbba593c514e8 to your computer and use it in GitHub Desktop.
var Promise = require('bluebird');
var prepareKaboom = function () {
return Promise.try( function () {
return 'ok';
});
}
var someFunction = function () {
return Promise.try(function() {
return prepareKaboom() // ISSUE was missing 'return' here
.then(function(ok) {
if(ok) {
throw new Error("big bad error");
}
})
});
}
var someOtherPromise = function () {
return Promise.try(function() {
return 'OK';
})
}
someFunction().then(someOtherPromise).catch(function(error){console.log("Reached? Got error", error.message);});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment