by gfxmonk · 12y ago · 0 comments
function g() {
return somePromise.then(function() {
setTimeout(function() {
throw new Error();
}, 500);
});
}
g(); // crash
But at that point, you're not using promises anymore so all bets are off.However if you use a promise-based timeout too:
function f() {
return somePromise.then(function() {
return Q.delay(1000).then(function() {
throw new Error("Oops");
});
});
}
f().catch(function(e) {
console.log(e.message); // logs Ooops.
});
No problem bubbling that.(However, they do leave async exceptions from callbacks alone - only domains can handle those)