title: How to throw exception in Web API?
body: <p>How can I throw a exception to in ASP.net Web Api?</p>
  
  <p>Below is my code:</p>
  
  <pre><code>public Test GetTestId(string id)
  {
      Test test = _test.GetTest(id);
  
      if (test == null)
      {
          throw new HttpResponseException(HttpStatusCode.NotFound);
      }
  
      return test;
  }
  </code></pre>
  
  <p>I don't think I am doing the right thing, How do my client know it is a <code>HTTP 404</code> error?</p>