Skip to content

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

Description

@cowwoc

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions