summaryrefslogtreecommitdiff
path: root/src/application/mystic
diff options
context:
space:
mode:
Diffstat (limited to 'src/application/mystic')
-rw-r--r--src/application/mystic/forum/Database.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/application/mystic/forum/Database.php b/src/application/mystic/forum/Database.php
index 6d633fa..a1e67ea 100644
--- a/src/application/mystic/forum/Database.php
+++ b/src/application/mystic/forum/Database.php
@@ -47,13 +47,20 @@ class Database {
return $buf;
}
+ private static function exception_error_handler($errno, $errstr, $errfile, $errline ) {
+ throw new \ErrorException(html_entity_decode($errstr), $errno, 0, $errfile, $errline);
+ }
+
public function __construct(string $connectionString) {
try {
+ set_error_handler(self::exception_error_handler(...));
$conn = \pg_connect($connectionString);
if ($conn !== false)
$this->connection = $conn;
} catch (\ErrorException $ex) {
throw new DatabaseConnectionException($ex->getMessage(), $ex->getCode(), $ex);
+ } finally {
+ restore_error_handler();
}
}