title: ASP.NET WebAPI Global error handling filter not working when model binding error occurs
body: <p>I wrote web API in .NET Framework. I made a global error filter.</p>
  <pre><code> public class UnhandledExceptionFilter : ExceptionFilterAttribute
   {
      public override void OnException(HttpActionExecutedContext context)
      {
         //log somewhere 
         //Make user friendly error message
      }
   }
  </code></pre>
  <p>And I added it to global filters</p>
  <pre><code>config.Filters.Add(new UnhandledExceptionFilter());
  </code></pre>
  <p>This works fine when an error occurs in the controller. But it does not work when an error occurs in default model binding.
  Let's say I have one action and it gets one <code>DateTime</code> parameter.</p>
  <pre><code> public class MyController: ApiController
   {
      public override void CheckBirthdate(DateTime birthdate)
      {
         throw new Exception(&quot;Test&quot;);
      }
   }
  </code></pre>
  <p>If I call <code>MyController/CheckBirthdate?birthdate=03/05/2021</code> like that my global error handling works. But I call <code>MyController/CheckBirthdate?birthdate=test</code> like that my global error handling not works. I get back error like that</p>
  <blockquote>
  <p>Could not convert string to DateTime: test. Path 'birthdate'</p>
  </blockquote>
  <p>Why global error handling filter can not catch it? How can I solve it?.</p>