Promises: unhandled rejections and finally()

Felipe Gasper felipe at felipegasper.com
Sun Mar 29 00:04:00 UTC 2020


Hello,

In node 12 as well as the latest Chrome and FF (all on macOS) I see the following:

-----
var y,n; var p = new Promise( (yy,nn) => { y=yy; n=nn } ); n(789);
==> produces 1 unhandled-rejection warning

var y,n; var p = new Promise( (yy,nn) => { y=yy; n=nn } ); p.finally( () => {} ); n(789);
==> produces 1 unhandled-rejection warning

var y,n; var p = new Promise( (yy,nn) => { y=yy; n=nn } ); p.finally( () => {} ); p.finally( () => {} ); n(789);
==> produces 2 unhandled-rejection warnings

var y,n; var p = new Promise( (yy,nn) => { y=yy; n=nn } ); p.finally( () => {} ); p.finally( () => {} ); p.finally( () => {} ); n(789);
==> produces 3 unhandled-rejection warnings

-----

Could someone point me to something that would help me to understand the logic here? It looks like the first finally() is getting a “free pass” while only the 2nd and subsequent ones trigger their own unhandled-rejection warnings.

Thank you!

cheers,
-Felipe Gasper


More information about the es-discuss mailing list