back

by masswerk·12y ago·view on hn ↗
Thinking a bit further, but this is pure speculation (and quite over my level of insight into JS-engine-interna):

window.onerror gives you essentially a post mortem dump, as gives you the error message in the console (which now seems to be routed to the error-event). try-catch is essentially different in that it allows you to stay in the same execution context (call-stack, scope-chain, etc). It may well be that there is also a difference, when defining an error-eventListener inside a closure, as this would result in the same contextual necessities as a try-catch-clause (not in every aspect, but in some). Again, I would recommend some performance tests.

1 comments
Thanks for your input :). I'll definitely do some more rigorous testing — so far I've just run a few test suites and gone "looks about the same".