Where'd Promise#done go?

Domenic Denicola domenic at domenicdenicola.com
Tue Jun 18 15:07:23 PDT 2013


The logging solution proposed is not polyfillable with today's tools, at least not when logging to the browser console. 

The idea would be that rejection reasons are logged when nobody has handled them, but then "un-logged" when they are handled. Since there is no `console.unlog`, you see our problem.

You could "polyfill" this by creating a secondary "console" overlay on top of the browser window. I believe when.js has something like this in an experimental branch:

https://github.com/cujojs/when/commit/65f89e9eeb397186aa1508bc58e49653aca2fcb4

Theirs is based off of a proposed Promises/A+ API, `console.unhandledRejection` and `console.rejectionHandled`, which would allow cross-promise-library sharing of such an interface:

https://github.com/promises-aplus/unhandled-rejections-spec/issues/2

I know RSVP.js has expressed interest in this as well, and I speak for Q in saying we would love that. At this point it's just a matter of someone, perhaps myself, putting in the time to create a generic bookmarklet that pops up a unhandled-rejections console and intercepts `console.unhandledRejection`/`console.rejectionHandled`.

---

>From the larger perspective of #extendthewebforward everything-should-be-polyfillable, I'd say the missing piece of the web platform for this is `console.unlog`. Not sure how excited browser vendors are about implementing that?


More information about the es-discuss mailing list