I'm using window.onerror to catch and log client-side errors. I've read about the various caveats to this approach, but I haven't been able to track down any info on this particular case.
For some reason IE9 does not seem to catch stack overflow exceptions. The below example catches both errors when run in Chrome and Firefox as well as if I use devtools in IE9 and set browser mode to IE8 or IE7. However, when run in IE9 mode, it only catches
the 'test' is undefined exception, but ignore the stack overflow exception.
I have put together a simple example, to demonstrate this:
window.onerror = errorHandler; function errorHandler (msg) { alert(msg); } setTimeout(function () { test.test = "test"; }, 1000); setTimeout(function stackoverflow() { stackoverflow(); }, 2000);
Here is a working example as well: http://jsfiddle.net/Mzvbk/1/
The question is also available on SO: http://stackoverflow.com/q/12044155/678801
Can anyone shed some light on why this is?