> Again, this is a generic issue for promises: a good solution there will
> "fix" everything.
It's inherent in the promise design, there is no way to truly fix
promises. You have to mark the end of a promise chain. It's always
going to be that way.
> My preferred solution to this problem: modify host-to-user "dispatchers" so
> that if user code returns a rejected promise to the host, an error is
> reported. So for instance, if user code returns a rejected promise from a
> DOM element event handler, the browser would log the error and call
> `window.onerror`. With async functions, this would work almost
> transparently:
>
> element.addEventListener("click", async event => {
> throw new Error("boom");
> });
>
> The host would pick up the rejection returned from the handler and report
> the error.
If you've ever worked on a complex app that uses promises, you know
this doesn't really change anything. Promise chains are everywhere and
you have to make sure to end them.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss