Skip to content
This repository has been archived by the owner on Oct 2, 2021. It is now read-only.

catch unhandled rejections #5

Closed
art-in opened this issue Oct 11, 2015 · 3 comments
Closed

catch unhandled rejections #5

art-in opened this issue Oct 11, 2015 · 3 comments

Comments

@art-in
Copy link

art-in commented Oct 11, 2015

I've noticed that with default Meteor's then/promise polyfill there is no way to catch unhandled rejections.
then/promise#70

To solve this I'm looking for some way to replace then/promise with petkaantonov/bluebird, since bluebird can do process.on("unhandledRejection", function() {...})

I've tried to meteor add mvrx:bluebird, but looks like Meteor's core promise polyfill hides bluebird since "unhandledRejection" does not catch, and this fails:
if (!Promise.noConflict) { throw Error('NO BLUEBIRD'); }

Any ideas?

@art-in
Copy link
Author

art-in commented Oct 11, 2015

Hopefully then/promise has non standard .done() method, which throws unhandled rejection outside the promise. So it is not a problem for me anymore.

promise
    .then(function() {
        throw 'BOOM'
    })
    .done() // exception thrown outside

@art-in art-in closed this as completed Oct 11, 2015
@benjamn
Copy link
Contributor

benjamn commented Oct 12, 2015

I've been thinking about reducing the scope of this package so that users have to provide their own Promise implementation, which should make it easier to use in an existing environment where you already have a preferred polyfill. Would that be better for you, even though you found a workaround in this case?

@art-in
Copy link
Author

art-in commented Oct 12, 2015

@benjamn Yes, I think such option still would be better.
Namely because then/promise forces me to use non Promise+ standard .done() method.

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

No branches or pull requests

2 participants