A way of explicitly reporting exceptions

Jason Orendorff jason.orendorff at gmail.com
Tue Jun 24 11:43:28 PDT 2014


On Tue, Jun 24, 2014 at 8:38 AM, C. Scott Ananian <ecmascript at cscott.net> wrote:
> I am ambivalent about where it goes; it depends to some degree with
> how the feature is implemented.
>
> `setTimeout(function() { throw e; }, 0);` is ugly, but it seems to
> have most of the behavior you want.

What. Strongly disagree. Timing matters!

- Error output should appear in the correct order relative to other
output. Shuffling output confounds printf-style debugging (which is
hardly rare in web dev).

- In particular, if this error causes other errors, it should be
reported before the others, so as to avoid violating causality.

- Later side effects against e shouldn't affect the error message
that's displayed.

That's only taking diagnostic output into account. But it seems like
timing would be just as important for the purposes of window.onerror
etc.

> [...]
> Finally, it hasn't been discussed much, but some platforms provide
> explicit access to the 'uncaughtException' handler.

+1. This feature would be a complement to what bz proposed. Either
feature could be added and used independently from the other.

-j


More information about the es-discuss mailing list