Wouldn't using the second parameter of .then() to catch exceptions work instead of .catch()?
promise.then(function(){
throw new Error('Oh no, not caught');
}, function(err){
});
But this will catch it: promise.then(function(){
throw new Error('Oh no!');
}).catch(function(err){
// Caught it ;)
});
As will this: promise.then(function(){
throw new Error('Oh no!');
}).then(null, function(err){
// Caught it ;)
});
Point being that your error handling need to be absolute last, and not paired with a success handler.You could at best use `setTimeout` or `nextTick` to escape from `Promise`'s call stack and throw there.