How can I get hold of the stack propery of an Error object when using JQuery
<p>It appears that IE, Chrome and Firefox all support the .stack property of the error object.</p>

<p>I have a facility in my application to log errors when in production mode, by hooking into the window.onerror property and using it to generate a message that I log to the server.  In non production mode however, I want to ensure I get the maximum information I can about the error as soon as it occurs.</p>

<p>I read that the modern browsers all have a stack property on the "Error" object, which returns a string giving the recent stack frames. I've seen this object referred to as the thing that gets passed to the catch function of a try catch block, but I realised as soon as I added it around my main code that that is pretty useless.  My code path is small before returning - the meat of the application is in asynchronous functions that are fired when the user does anything, or an ajax request completes, or something times out.
r
Without having to build try catch into every asynchronous function, is there anyway to just trigger if of an error event?</p>

<p>I can't find it in any data I get back from JQuery when I attach to the windows on error function, but is there any other way to retrieve the error object from a JQuery event?</p>
