Have PDO errors throw an exception

This commit is contained in:
William 2022-01-26 14:36:57 +01:00
parent bde5082805
commit 50569c4f26

View File

@ -25,6 +25,7 @@ class Database
$dsn = "mysql:host={$args['host']};dbname={$args['database']};charset={$args['charset']}";
$options = [
PDO::ATTR_PERSISTENT => true,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
];
return new PDO($dsn, $args['user'], $args['password'], $options);
}