title: How To Catch an Exception [C++/CX]
body: <p>I am working on a Windows 8 app (C++). I have used the httpclient class from the Windows 8 samples collection. </p>
  
  <pre><code>inline void CheckHResult(HRESULT hResult)
  {
      if (hResult == E_ABORT)
      {
          concurrency::cancel_current_task();
      }
      else if (FAILED(hResult))
      {
          throw Platform::Exception::CreateException(hResult);
      }
  }
  </code></pre>
  
  <p>This function throws an exception when the app is not connected to the internet. I am trying to catch the exception in the following lambda like this.</p>
  
  <pre><code>return completionTask.then([this, stringCallback](tuple&lt;HRESULT, wstring&gt; resultTuple)
  {
      try
      {
          CheckHResult(std::get&lt;0&gt;(resultTuple));
      }
  
      catch(Exception^ ex)
      {
  
      }
  
      return std::get&lt;1&gt;(resultTuple);
  }); 
  </code></pre>
  
  <p>But it is still showing an unhandled exception:</p>
  
  <pre><code>First-chance exception at 0x77194B32 in Sample.exe: Microsoft C++ exception: Platform::COMException ^ at memory location 0x08C7EDF4. HRESULT:0x800C0005
  If there is a handler for this exception, the program may be safely continued.
  </code></pre>
  
  <p>Is there anything I am doing wrong?</p>