Display exact PDO error on default homepage

This commit is contained in:
ADmad 2013-01-11 18:41:29 +05:30
parent d8551c49e5
commit d6c2df7b6b
2 changed files with 16 additions and 2 deletions

View file

@ -99,6 +99,13 @@ if (isset($filePresent)):
$connected = ConnectionManager::getDataSource('default');
} catch (Exception $connectionError) {
$connected = false;
$errorMsg = $connectionError->getMessage();
if (method_exists($connectionError, 'getAttributes')) {
$attributes = $connectionError->getAttributes();
if (isset($errorMsg['message'])) {
$errorMsg .= '<br />' . $attributes['message'];
}
}
}
?>
<p>
@ -111,7 +118,7 @@ if (isset($filePresent)):
echo '<span class="notice">';
echo __d('cake_dev', 'Cake is NOT able to connect to the database.');
echo '<br /><br />';
echo $connectionError->getMessage();
echo $errorMsg;
echo '</span>';
endif;
?>

View file

@ -99,6 +99,13 @@ if (isset($filePresent)):
$connected = ConnectionManager::getDataSource('default');
} catch (Exception $connectionError) {
$connected = false;
$errorMsg = $connectionError->getMessage();
if (method_exists($connectionError, 'getAttributes')) {
$attributes = $connectionError->getAttributes();
if (isset($errorMsg['message'])) {
$errorMsg .= '<br />' . $attributes['message'];
}
}
}
?>
<p>
@ -111,7 +118,7 @@ if (isset($filePresent)):
echo '<span class="notice">';
echo __d('cake_dev', 'Cake is NOT able to connect to the database.');
echo '<br /><br />';
echo $connectionError->getMessage();
echo $errorMsg;
echo '</span>';
endif;
?>