Error handling for PDO exception