summaryrefslogtreecommitdiff
path: root/src/application/mystic/forum/Database.php
diff options
context:
space:
mode:
authorJonas Kohl2024-09-16 19:32:09 +0200
committerJonas Kohl2024-09-16 19:32:09 +0200
commit6b7e714b59e28bc138681662006941274c3261af (patch)
treec683082c0a00681542db02d415bd45968f0a517b /src/application/mystic/forum/Database.php
parentfd3d969cf658475709db6a1e5090069cce51cbbd (diff)
A lot more stuff
Diffstat (limited to 'src/application/mystic/forum/Database.php')
-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();
}
}