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

Investigate reporting multiple wiring errors #104

Open
briancavalier opened this issue Jun 4, 2013 · 2 comments
Open

Investigate reporting multiple wiring errors #104

briancavalier opened this issue Jun 4, 2013 · 2 comments

Comments

@briancavalier
Copy link
Member

See discussion here. Rather than failing fast on the first rejection, it's possible we could use when.settle to allow all wiring promises to settle and then report the subset (if any) that rejected.

We should at least investigate whether this is possible and useful.

@unscriptable
Copy link
Member

Just coding out loud....

var err;
settled.then(function (descriptors) {
    descriptors.reduce(function (errors, d) {
        if(d.state === 'rejected') {
            errors.push(d.reason);
        } 
        return errors
    }, []);
    if (errors.length > 1) {
        err = new Error('Multiple errors encountered during wiring. See errors property for details.');
        err.errors = errors;
    }
    else {
        err = errors[0];
    }
    require.error(err);
});

@briancavalier
Copy link
Member Author

Yep, that pretty much looks like how we'd do it.

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

2 participants