Permalink
Browse files

Display exact PDO error on default homepage

  • Loading branch information...
ADmad committed Jan 11, 2013
1 parent d8551c4 commit d6c2df7b6b4c8d41b6e99a05e45fc1d00f66cf13
Showing with 16 additions and 2 deletions.
  1. +8 −1 app/View/Pages/home.ctp
  2. +8 −1 lib/Cake/Console/Templates/skel/View/Pages/home.ctp
View
@@ -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;
?>
@@ -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;
?>

0 comments on commit d6c2df7

Please sign in to comment.