title: Catch json.net serialization errors
body: <p>I'm working on a web api using dotnet core 2.2 and we want to catch serialization exception and return a 400 badRequest to distinguish from the validation errors 422UnprocessableEntity. We tried to create  an exception handler</p>
  
  <pre><code>public void JsonSerializerExceptionHandler(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs args)
      {
          args.ErrorContext.Handled = true;
          var errorContext = args.ErrorContext;
          if (errorContext == null)
          {
              return;
          }
  
          var error = errorContext.Error;
          throw new SerializationException(error.Message, error.InnerException);
      }
  </code></pre>
  
  <p>but when it throw it throw an other Exception of type InvalidOperationException with message </p>
  
  <blockquote>
    <p>Current error context error is different to requested error.</p>
  </blockquote>
  
  <p>We tried different approach but can't find a solution. Can someone help? </p>