title: Throw new exception with a code and a message
body: <p>I'm parsing JSON from a server that contains <code>statusCode</code> and <code>statusMessage</code>... How do I throw these in my exception so that I <em>don't</em> have to use <code>if</code>-statements in my catch?  So that I can have a generic process that handles all <code>exc.Code</code> and <code>exc.Message</code>, without having to look for it.</p>
  
  <p><strong>Here are my throws</strong></p>
  
  <pre><code>else if (statusCode.Equals(26) &amp;&amp; statusMessage.StartsWith("response sent", StringComparison.OrdinalIgnoreCase))
      throw new Exception("Response sent - 26");
  else if (statusCode.Equals(0))
      throw new Exception("Fatal exception - 0");
  else if (statusCode.Equals(3))
      throw new Exception("Invalid parameters - 3");
  else if (statusCode.Equals(24))
      throw new Exception("Incorrect response Id - 24");
  </code></pre>
  
  <p><strong>Here's my catch</strong></p>
  
  <pre><code>try
  {
      dataResponse = GetStatus.RequestStatus(httpRequest);
  }
  catch (Exception exc)
  {
      if (exc.Message.ToString() == "Response sent - 26")
      {
          string errorCode = "26";
          string errorMessage = "Response Sent";
          // do things with erroCode and errorMessage...
      }
      else if (exc.Message.ToString() == "Fatal exception - 0")
      {
          string errorCode = "0";
          string errorMessage = "Fatal exception";
          //do things with errorCode and errorMessage...
      }
      // else ifs else ifs etc.. etc...
  }
  finally
  {
      // do things
  }
  </code></pre>