title: How do I hook invoking controller action in MVC?
body: <p>In my MVC3 application I have lots of controllers and actions. Sometimes an exception is raised while executing an action. I want to be able to log that and let the exception be handled by MVC.</p>
  
  <p>Something like this pseudocode:</p>
  
  <pre><code>try {
      MvcInvokeControllerAction( controller, action, params );
  } catch( Exception e ) {
      trace( "Error while invoking " + controller + "-" +
         action + " with " + params + " details: " + getDetails( e ) );
      throw;
  }
  </code></pre>
  
  <p>What I want is to be able to catch the exception before it is first processed by MVC because sometimes MVC kicking in raises another exception and I see the latter in <code>Application_Error()</code> and the original exception is lots.</p>
  
  <p>How do I achieve such hooking?</p>