Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.catch() prevents .then() from getting executed #65

Open
cowwoc opened this issue Jun 20, 2013 · 0 comments
Open

.catch() prevents .then() from getting executed #65

cowwoc opened this issue Jun 20, 2013 · 0 comments

Comments

@cowwoc
Copy link

cowwoc commented Jun 20, 2013

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant