summaryrefslogtreecommitdiff
path: root/db.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2020-09-12 17:02:30 +0300
committerAndrew Dolgov <[email protected]>2020-09-12 17:02:30 +0300
commit069489d437f66cded1ef97b18ae832f00b6cba82 (patch)
tree37752bbafa7997271b52e7e54c219acec4086b20 /db.php
parentb09a0ed5d1861e0f291c2d76ed801556549e5588 (diff)
crash with an error message if PDO sqlite driver is missing and/or unable to initialize it
Diffstat (limited to 'db.php')
-rw-r--r--db.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/db.php b/db.php
index ad74639..e5c924c 100644
--- a/db.php
+++ b/db.php
@@ -4,7 +4,11 @@ class Db {
private $dbh;
private function __construct() {
- $this->dbh = new PDO('sqlite:' . SCRATCH_DB);
+ try {
+ $this->dbh = new PDO('sqlite:' . SCRATCH_DB);
+ } catch (Exception $e) {
+ die("Unable to initialize database driver (SQLite): $e");
+ }
//$this->dbh->busyTimeout(30*1000);
$this->dbh->query('PRAGMA journal_mode = wal;');
}