title: Uncaught PDOException reveals username and password
body: <pre><code>try {
      self::$dbinstance = new PDO(
          "mysql:host=$c[host];dbname=$c[dbname]", $c['user'], $c['password']
      );
  
      self::$dbinstance-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  } 
  catch(PDOException $e) {
      echo "Errors" . $e-&gt;getMessage();
  }
  </code></pre>
  
  <p>In the above code, if PDO fails to connect to the host, a <code>fatal error</code> reveals the username and password.</p>
  
  <pre class="lang-none prettyprint-override"><code>Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2003]
  Can't connect to MySQL server on '172.25.102.65' (10060)' in
  D:\xampp\htdocs\mytest\wh_client_2.1\classes\importmodule-class.php:33 Stack trace: #0
  D:\xampp\htdocs\mytest\wh_client_2.1\classes\importmodule-class.php(33): PDO-
  &gt;__construct('mysql:host=172....', 'host', 'password') #1
  </code></pre>
  
  <p>One possible way is to turn the <code>display_error=0</code> off in <code>php.ini</code>, but this way I won't able to know that when my host is not responding.</p>
  
  <p>Is there a way I can modify the error message?</p>