mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Display exact PDO error on default homepage
This commit is contained in:
parent
d8551c49e5
commit
d6c2df7b6b
2 changed files with 16 additions and 2 deletions
|
@ -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;
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue