Closed arichiardi closed 5 years ago
We are using sieppari - the cljs port - and we really are missing this.
In case of unexpected exception thrown in a promise there is nothing putting the :error
in the context and what is worse is that node is then printing a terrible warning and not doing anything significant.
One solution to this would be to add a protocol function on the async context.
It cannot work only on this
, because channel items would already be consumed. So my hunch would be to pass also the last item a/continue
consumed.
Thinking more about this it probably does not make sense to touch the protocols.
Some helper around each AsyncContex
could go a long way.
Need some more hammock time, any input is welcome :smile:
The problem seems to be that we don't catch async exceptions like we do sync ones. So when e.g. a rejected promise appears the Sieppari stack and queue get thrown away, the execution stops and you just get the rejected promise. We probably do have to add error handling functionality to the async protocol.
Hi again! As part of my port to cljs I realized what could be an issue..maybe.
It seems like at the moment the
continue
protocol only accepts one callback, which makes sense most of the times, the only issue beingjs/Promise
rejection.One could add another callback for errors but I am not myself convinced it is the right thing to do. It would certainly handle this kind of situation that at the moment trigger an uncaught error warning.
Or maybe it is simply better to let it blow and fail fast.
Thoughts?