title: joomla exception handling with DB error
body: <p>Trying to do exception handling and logging. So if I have something like this:</p>
  
  <pre><code>$db = JFactory::getDbo();
  $query = $db-&gt;getQuery(true);
  
  $query-&gt;select('*')
  $query-&gt;from('#__users');
  
  try
  {
      $db-&gt;setQuery($query);
      $result = $db-&gt;loadResult();
  }
  catch (RuntimeException $e)
  {
      $e-&gt;getMessage();
      JLog::add('This query failed: '.$query);
  
  }
  </code></pre>
  
  <p>My question is how best to test my exception code? Taking down the DB will just get Joomla to output this error and I never get into my exception code:</p>
  
  <p><code>Database connection error (2): Could not connect to MySQL.</code></p>
  
  <p>I want to be able to verify the exception and log get printed.</p>