[whatwg] Web Notification: API inconsistency

Tab Atkins Jr. jackalmage at gmail.com
Fri Aug 23 10:46:59 PDT 2013

On Fri, Aug 23, 2013 at 10:41 AM, Boris Zbarsky <bzbarsky at mit.edu> wrote:
> Given the last definition of then() I saw, this has a bit of a gotcha.
> Consider this code:
>   function callback() {
>     throw "Hey"
>   }
>   someAPI(callback);
> now in today's world, when some API calls back into callback an exception is
> reported to the console and window.error and whatnot.
> But if someAPI internally does:
>   var promise = new Promise();
>   return promise.then(callback);
> then all throwing from callback will do is set up the error state on the
> return value; the exception is not reported anywhere.
> Now UAs might end up reporting to the console when a promise with an
> unhandled error is GCed or something.  But window.onerror is SOL in this
> case.

Ah, yeah.  Hm, we previously had .done() to help with this, which
threw rather than rejecting the output promise, but that's been
removed.  I've seen some chatter about what the plan is to address the
swallowed-error problem, but I'm not sure what the current thinking is
for it.


More information about the whatwg mailing list