Extened error message on database failure
This commit is contained in:
parent
574256a01a
commit
6be386aca1
@ -7,7 +7,14 @@
|
|||||||
try {
|
try {
|
||||||
return $pdo = new PDO(DB_TYPE . ':host=' . DB_SERVER . ';dbname=' . DB_DATABASE, DB_USER, DB_PASSWORD);
|
return $pdo = new PDO(DB_TYPE . ':host=' . DB_SERVER . ';dbname=' . DB_DATABASE, DB_USER, DB_PASSWORD);
|
||||||
} catch(PDOException $e) {
|
} catch(PDOException $e) {
|
||||||
error('Database error.');
|
$message = $e->getMessage();
|
||||||
|
|
||||||
|
// Remove any sensitive information
|
||||||
|
$message = str_replace(DB_USER, '<em>hidden</em>', $message);
|
||||||
|
$message = str_replace(DB_PASSWORD, '<em>hidden</em>', $message);
|
||||||
|
|
||||||
|
// Print error
|
||||||
|
error('Database error: ' . $message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user