title: Retry a try/catch when it fails
body: <p>I've tried a few different try/catch loops to try and solve problems automatically but they always seem to cause the software to die.</p>
  
  <pre><code>$doLoop = true;
  
  while ($doLoop) {
  
      try {
          //do a thing
          insertIntoDb($data);
      } catch (Exception $e) {
          //try again
          insertIntoDb($data);
          //write error to file
          writeError($e);
      }
  }
  </code></pre>
  
  <p>Here's my original try/catch.</p>
  
  <p>The issue is sometimes the MySQL server 'goes away' and I need to catch that exception and keep retrying until it comes back.</p>
  
  <p>What can I change here to get this to keep retrying until successful?</p>