briancavalier / creed

Sophisticated and functionally-minded async with advanced features: coroutines, promises, ES2015 iterables, fantasy-land
https://briancavalier.github.io/creed
MIT License
273 stars 20 forks source link

Overhaul rejection tracking #32

Open bergus opened 8 years ago

bergus commented 8 years ago

Currently error reporting does keep track of every Rejected instance. ES7 promises (and afaik basically any other promise implementations) do however keep track of the promises (futures) that are rejected without handlers. See tc39/ecma262#76 for more links.

The problem with Creed's current approach is that it does not detect branching. Consider the example

const p = reject(…);
const q = p.then(…);
const r = p.catch(…);

While Creed does report p to be handled, it should actually have reported q as unhandled in the first place.

This is not an easy problem for sure with the nearing approach, as with x = reject(…), y = new Future, z = new Future we would have to distinguish z.become(y); y.become(x) from z.become(x); y.become(x) (in any order).

Any thoughts?


I am not sure to what extent creed does use the standardised rejection tracking events, I kinda have lost track of proposals/implementations/specifications. Btw, node has some nice tests here. Also this issue will probably solve the matter of silencer being an Action, I'd expect silencing to see some major change.