How to handle an exception occurring in a filter?
<p>I have various filters before a URL hits an controller action.</p>

<p>Very few filters have a complex logic which might throw exceptions.</p>

<p>Now, how do I catch these exceptions ?</p>

<p>For eg. I have a filter which handles exception occuring in a controller method. </p>

<p><code>[ActionFilter1]</code> is  a filter which handles any exception occuring in a controller method.</p>

<pre><code>public override void OnActionExecuting(ActionExecutingContext filterContext)
{

 //exception occuring here

}
</code></pre>

<p>One way is to do something like this:</p>

<pre><code>public override void OnActionExecuting(ActionExecutingContext filterContext)
    {
     try {
     //exception occuring here
     }
     catch {
     //log here
     }
    }
</code></pre>

<p>since there are <code>n</code> filters, I do not want to repeat this logic of adding <code>try</code> &amp; <code>catch</code> to each and every filter.</p>

<p>In that case, how can I proceed with a single place error handling which can handle any exceptions occurring in all these filters ?</p>