Skip to content

Instantly share code, notes, and snippets.

@EugeneKostrikov
Last active July 22, 2016 15:34
Show Gist options
  • Save EugeneKostrikov/175d150b9e997c901270b8c605ac358f to your computer and use it in GitHub Desktop.
Save EugeneKostrikov/175d150b9e997c901270b8c605ac358f to your computer and use it in GitHub Desktop.
var when = require('when'); //It is a regular A+ Promises library
function somethingThatThrows(){
throw new Error('Boom');
}
when.resolve('Hello')
.then(function(result){
somethingThatThrows();
return result;
}, function(err){
console.log('gotcha ', err);
return 'Ciao';
})
.then(function(result){
console.log('result ', result);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment