Different notation of the same expression - not the same behaviour?
- This will toss
Uncaught (in promise) v8
for you,
and I think it shouldn't! You may refresh on mdn://Promise/catch and гост://ecma2015.
var a = new Promise((resolve, reject) => setTimeout(_ => reject('v8'), 0));
a.catch(a => 1);
a.finally(a => 1);
- Basically the same code, but works as expected.
var a = new Promise((resolve, reject) => setTimeout(_ => reject('v8'), 0))
.catch(a => 1);
a.finally(a => 1);
!! There must be at least one .finally
or .then
chained, else example #1 will not toss that Uncaught (in promise)
.
Reproduced in the latest versions of FF and Chromium (though I did not test this with servo yet).
.catch
callback is executed in example #1..setTimeout, 0
just to positionreject
to top of call stack, timeout could be more than 0 anyways.
Can someone please explain, what did I miss? Is it just me or JavaScript?