How to catch ODataErrorException when I am making an OData call through HttpWebRequest in C#?
问题 I am trying to call an OData service from my .Net console application using c#. I am using HttpWebRequest to make the call. Now if there is an OData specific error, for example, an invalid JSON payload, then an ODataErrorException is thrown from the OData server. My question is how to catch that ODataErrorException and extract the proper message out of it? The exception gets caught in WebException catch block, and it only shows me "400 Bad Request". But it doesn't show me the actual error