W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2013

Re: [whatwg] Web Notification: API inconsistency

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 23 Aug 2013 10:46:59 -0700
Message-ID: <CAAWBYDAq482=SsCNUvBgujD4Ugw0ZiHhYQvE46nf7-LL43Wbrg@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: WHATWG <whatwg@lists.whatwg.org>
On Fri, Aug 23, 2013 at 10:41 AM, Boris Zbarsky <bzbarsky@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.

~TJ
Received on Friday, 23 August 2013 17:47:51 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:23 UTC