promises-aplus / unhandled-rejections-spec

Discussion and drafts of possible ways to deal with unhandled rejections, across implementations
6 stars 0 forks source link

Library hooks #3

Open domenic opened 11 years ago

domenic commented 11 years ago

Like #2, but the hooks are put on the libraries themselves (e.g. Q.onUnhandledRejection = ... or Q.on("unhandledRejection", ...)).

This has the con of making it hard to write generic debugging tools, but the pro of not co-opting some environment feature (like console or the global object) for nefarious purposes.

briancavalier commented 11 years ago

I much prefer the environment hooks of #2, but this would be a decent fallback if promise impls agree on naming for a core set of hooks to make it easier on debugging tools to be configured, or to discover them automagically.

FWIW, I don't really consider "providing a helpful debugging experience" to be nefarious :)

ForbesLindesay commented 11 years ago

There would need to be a consistent method of discovering those libraries as well though.