title: Catch exceptions while making web api calls
body: <p>I am making a lot of web api calls in my c# code. I don't know how to catch errors. Suppose, internet connection isn't working, then my code shows runtime error. How to I properly put them into try catch block, What's the general rule. All the articles I found were on how to throw back the error and error message.<br/>
  example API calls:</p>
  
  <pre><code> WebResponse webResponse = webRequest.GetResponse();
   string res = webResponse.ToString();
  </code></pre>
  
  <p>Also</p>
  
  <pre><code>using (var client = new HttpClient())
        client.BaseAddress = new Uri(CairoBaseUrl);
        var getStringTask = client.GetStringAsync(requestUrl);
        response = await getStringTask;
  </code></pre>
  
  <p>And,</p>
  
  <pre><code>HttpResponseMessage response = await client.PostAsync(
                  url,requestContent);
  </code></pre>