title: ASP.NET MVC Ajax Error handling
body: <p>How do I handle exceptions thrown in a controller when jquery ajax calls an action?</p>
  
  <p>For example, I would like a global javascript code that gets executed on any kind of server exception during an ajax call which displays the exception message if in debug mode or just a normal error message.</p>
  
  <p>On the client side, I will call a function on the ajax error.</p>
  
  <p>On the server side, Do I need to write a custom actionfilter?</p>