title: jQuery: global exception handler
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/205688/javascript-exception-handling">JavaScript Exception Handling</a>  </p>
  </blockquote>
  
  
  
  <p>I have a web application where 100% of the javascript code executes as jQuery event handlers (I guess most jQuery apps are like this).</p>
  
  <p>The question is how can I define a global exception handler. That is, if a function that is called when any exception that happens within any jQuery event handler goes uncaught (whether it is onload, click, a succesfull ajax call, an ajax error, whatever). 
  My function would receive the error info (exception, stacktrace, whatever). </p>
  
  <p><strong>Clarification:</strong> I don't mean globally catching in ajax problems generated by the server or network, but globally catching problems that are due to (presumably) bugs in our code.</p>