## Trivia * Some APIs use `unhandledRejection`, some use `unhandledrejection`. Note the capitalization difference. * WhenJS is basically [completely broken](https://github.com/cujojs/when/issues/490) in bundled environments. It doesn't seem like this will be fixed any time soon... * Bluebird claims that you should use `self.addEventListener` in a WebWorker context, but that does not actually appear to work - instead, I've used `self.onunhandledrejection`, which definitely *does* work. * Due to the subtle differences between implementations, and the fact that different libraries respond differently to having both the modern and legacy event handler defined, you actually need to *deduplicate* errors to handle all rejections correctly. * Some events come in a wrapper object. Some do not. * What a mess... ## Implementation chart (according to the documentation and specs, at least...) Bluebird (http://bluebirdjs.com/docs/api/error-management-configuration.html#global-rejection-events) * `process.on//unhandledRejection`: __(Node.js)__ Potentially unhandled rejection. * `process.on//rejectionHandled`: __(Node.js)__ Cancel unhandled rejection, it was handled anyway. * `self.addEventListener//unhandledrejection`: __(WebWorkers)__ Potentially unhandled rejection. * `self.addEventListener//rejectionhandled`: __(WebWorkers)__ Cancel unhandled rejection, it was handled anyway. * `window.addEventListener//unhandledrejection`: __(Modern browsers, IE >= 9)__ Potentially unhandled rejection. * `window.addEventListener//rejectionhandled`: __(Modern browsers, IE >= 9)__ Cancel unhandled rejection, it was handled anyway. * `window.onunhandledrejection`: __(IE >= 6)__ Potentially unhandled rejection. * `window.onrejectionhandled`: __(IE >= 6)__ Cancel unhandled rejection, it was handled anyway. WhenJS (https://github.com/cujojs/when/blob/3.7.0/docs/debug-api.md) * `process.on//unhandledRejection`: __(Node.js)__ Potentially unhandled rejection. * `process.on//rejectionHandled`: __(Node.js)__ Cancel unhandled rejection, it was handled anyway. * `self.addEventListener//unhandledrejection`: __(WebWorkers, Modern browsers, IE >= 9)__ Potentially unhandled rejection. * `self.addEventListener//rejectionhandled`: __(WebWorkers, Modern browsers, IE >= 9)__ Cancel unhandled rejection, it was handled anyway. Spec (https://gist.github.com/benjamingr/0237932cee84712951a2) * `process.on//unhandledRejection`: __(Node.js)__ Potentially unhandled rejection. * `process.on//rejectionHandled`: __(Node.js)__ Cancel unhandled rejection, it was handled anyway. Q (https://github.com/kriskowal/q/blob/e01d7b2875e784954e11a1668551288f5ffe46cc/q.js#L1037-L1113) * `process.on//unhandledRejection`: __(Node.js)__ Potentially unhandled rejection. * `process.on//rejectionHandled`: __(Node.js)__ Cancel unhandled rejection, it was handled anyway. Spec (WHATWG: https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections) * `.addEventListener//unhandledrejection`: __(Browsers, WebWorkers)__ Potentially unhandled rejection. * `.addEventListener//rejectionhandled`: __(Browsers, WebWorkers)__ Cancel unhandled rejection, it was handled anyway. * `window.onunhandledrejection`: __(Browsers)__ Potentially unhandled rejection. * `window.onrejectionhandled`: __(Browsers)__ Cancel unhandled rejection, it was handled anyway. ES6 Promises in Node.js (https://nodejs.org/api/process.html#process_event_rejectionhandled onwards) * `process.on//unhandledRejection`: Potentially unhandled rejection. * `process.on//rejectionHandled`: Cancel unhandled rejection, it was handled anyway. Yaku (https://github.com/ysmood/yaku#unhandled-rejection) * `process.on//unhandledRejection`: __(Node.js)__ Potentially unhandled rejection. * `process.on//rejectionHandled`: __(Node.js)__ Cancel unhandled rejection, it was handled anyway. * `window.onunhandledrejection`: __(Browsers)__ Potentially unhandled rejection. * `window.onrejectionhandled`: __(Browsers)__ Cancel unhandled rejection, it was handled anyway. `then/promise` * Currently not implemented. ([issue](https://github.com/then/promise/issues/70)) `es6-promise` * Currently not implemented. ([issue](https://github.com/stefanpenner/es6-promise/issues/70))