title: How do I get StatusCode from HttpRequestException?
body: <p>I'm probably missing something obvious here.</p>
  
  <p>I'm using <code>HttpClient</code> which throws <code>HttpRequestException</code> that contains <code>StatusCode</code> in the Message string.</p>
  
  <p>How can I access that <code>StatusCode</code>?</p>
  
  <hr>
  
  <p><strong>Edit</strong>: More info, I wrote this question in rush.</p>
  
  <p>I'm using <code>HttpClient</code> to access another API within my WebApi project. Yes, I know why I'm calling <code>EnsureSuccessStatusCode()</code>. I want to propagate some errors downstream such as 404 and 403.</p>
  
  <p>All I wanted was to consistently transform <code>HttpRequestException</code> into <code>HttpResponseException</code> using custom <code>ExceptionFilterAttribute</code>. </p>
  
  <p>Unfortunately, <code>HttpRequestException</code> does not carry any extra info I could use besides the message. I was hoping to uncover <code>StatusCode</code> in raw (int or enum) form.</p>
  
  <p>Looks like I can either:</p>
  
  <ol>
  <li>Use the message to switch the status code (bleh)</li>
  <li>Or create my version of EnsureSuccessStatusCode and throw exception that's actually usable.</li>
  </ol>