- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Wed, 04 Sep 2013 14:47:18 -0400
- 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) {
reject(42);
});
nothing will be reported. Likewise if you do:
new Promise(function(accept, reject) {
accept(42);
}).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.
-Boris
Received on Wednesday, 4 September 2013 18:47:47 UTC