PHP: Exceptions
<?php
try{
$dsn = 'mysql:dbname=test;host=localhost';
$dbh = new PDO($dsn,'username','password');
echo 'Connected to Database';
}catch (PDOException $e){
echo 'Connection Failed: '.$e->getMessage();
}catch(Exception $e){
echo 'A Unknown Error Occurred: '.$e->getMessage();
}
echo 'I am still parsed, even if there was an error';
?>