Created
November 10, 2015 05:14
-
-
Save fullstackwebdev/dadf7e5dbba593c514e8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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