W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2013

Re: Promises: final steps

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 04 Sep 2013 14:47:18 -0400
Message-ID: <52278036.9060503@mit.edu>
To: public-script-coord@w3.org
On 9/4/13 2:35 PM, Tab Atkins Jr. wrote:
> As far as I know, the current plan is still that devtools should
> handle swallowed exceptions, since we got rid of .done() some time
> ago.  Plans may have changed without me knowing, though!

Note that defining "swallowed" can a bit hard.

In practice, what I've implemented in Gecko is that when a promise is 
GCed, if all of the following hold:

1)  The promise was rejected.
2)  The promise never had then() called on it (or anything else that
     would add a reject callback).
3)  The value the promise was rejected with is an ES Error object.

then the Error will be reported.

That means that if you do something like this:

   new Promise(function(accept, reject) {

nothing will be reported.  Likewise if you do:

   new Promise(function(accept, reject) {
   }).then(function () { throw 42; });

That's because there is no real way to tell those two cases apart from 
inside a Promise: in either case it was rejected with the value 42.

So this will catch _some_ types of exceptions, but not all.

Received on Wednesday, 4 September 2013 18:47:47 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:18 UTC