mpromise icon indicating copy to clipboard operation
mpromise copied to clipboard

Provide unhandled rejection detection

Open benjamingr opened this issue 9 years ago • 3 comments

Cross post of https://github.com/Automattic/mongoose/issues/2918

Hi, most promise libraries (Bluebird, When, Q, Native promises in io.js and so on) support unhandled rejection detection which greatly simplifies dealing with errors in promises. Other libraries (RSVP, native promises in node.js) plan to add this feature.

Here is the proposal as currently implemented in most major libraries.

It could be great if Mongoose promises supported these hooks - I'd love to help with implementation guidance if you'd like it.

benjamingr avatar Apr 27 '15 08:04 benjamingr

Anyone?

benjamingr avatar Jun 19 '15 09:06 benjamingr

@benjamingr require('mongoose/lib/promise').prototype.error = console.error; Will do the trick.

Doweig avatar Aug 12 '15 09:08 Doweig

:+1: Ohh, wait, that's my job... On it. @benjamingr if you're still interested in helping the place to tigger the hooks is https://github.com/aheckmann/mpromise/blob/master/lib/promise.js#L108 Should add a few tests as well.

refack avatar Aug 15 '15 22:08 refack