title: How to handle exceptions in Odata V4 client?
body: <p>Asp.Net Web API Odata Controller Action:</p>
  
  <pre><code>public async Task&lt;IHttpActionResult&gt; Post(Product product)
  {
      if (!ModelState.IsValid)
      {
          return BadRequest(ModelState);
      }
      db.Products.Add(product);
      await db.SaveChangesAsync();
      return Created(product);
  }
  </code></pre>
  
  <p>Odata client code:
  (Odata v4 client code generator v4)</p>
  
  <pre><code>static void AddProduct(Default.Container container, ProductService.Models.Product product)
  {
      container.AddToProducts(product);
      var serviceResponse = container.SaveChanges();
      foreach (var operationResponse in serviceResponse)
      {
          Console.WriteLine("Response: {0}", operationResponse.StatusCode);
      }
  }
  </code></pre>
  
  <p>I would like to handle exception in a proper way inside <code>AddProducts()</code> Method while saving the changes.</p>
  
  <p>How can I catch process the <code>ModelState</code> error which is sent from server <code>return BadRequest(ModelState);</code>?</p>
  
  <p>Finally I just want to show the error message to the end uses which was sent from server.
  Example:
  "Product category is required."</p>
  
  <p>What is the use of <code>ODataException</code> class? Will this help  me?</p>
  
  <p>Please help me.</p>