title: C++ Try Catch inside loop
body: <p>I have this C++ program with the following general structure</p>
  
  <pre><code>1st while (condition A == true)
    //some code for 1st loop
  
    2nd while (condition B == true)
      //some code for 2nd loop
      try
        //some code for try
      catch
        //condition B == false (supposed to leave 2nd loop and go back to first loop)
  </code></pre>
  
  <p>I want it to get out of 2nd loop when there's an exception and go back to 1st loop until condition B is tue again. As described above it doesn't work as I expect. What seems to be happening is that code gets stuck in <code>catch</code> and never leaves it.</p>
  
  <p>How can I arrange it to make it work as I need?</p>
  
  <p>Note: condition A is never false.</p>