Promises
Promises copied to clipboard
.catch() prevents .then() from getting executed
Given:
function third()
{
return new Future(function(future)
{
console.log("third");
future.resolve();
}).then(function()
{
console.log("third.then")
});
}
function second()
{
return new function()
{
console.log("second");
return third().catch(errorHandler);
};
}
return new Future(function(future)
{
console.log("first");
future.resolve(second());
}).then(function()
{
console.log("first.then");
});
I am expecting the following output:
first second third third.then first.then
but first.then is missing. If I comment out .catch(errorHandler)
I get first.then as expected. It seems that .catch() is blocking .then().
Expected behavior: .catch() should intercept errors thrown by child Futures, but allow control to bubble up to parent Futures on success.