title: Getting a HttpStatusCode of 0
body: <p>Why am I getting a HttpStatusCode of 0 if I point the service my client is connecting to to a bad URL.</p>
  
  <p>My statusCodeAsInt is showing up as a 0.  Why is it not showing up as a 404 and being handled?</p>
  
  <pre><code>IRestResponse response = client.Execute(restReq);
  HttpStatusCode statusCode = response.StatusCode;
  
  var statusCodeAsInt = (int) statusCode;
  
          if (statusCodeAsInt &gt;= 500)
          {
              throw new InvalidOperationException("A server error occurred: " + response.ErrorMessage, response.ErrorException);
          }
          if (statusCodeAsInt &gt;= 400)
          {
              throw new InvalidOperationException("Request could not be understood by the server: " + response.ErrorMessage,
                  response.ErrorException);
          }
  </code></pre>
  
  <p>What is the proper way to handle this RestResponse?</p>