1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-06 14:16:39 +02:00

DibiPdoDriver: missing driver throws DibiNotSupportedException exception

This commit is contained in:
David Grudl
2015-01-12 10:40:41 +01:00
parent 8395abb04f
commit 100f978b9b

View File

@@ -68,13 +68,12 @@ class DibiPdoDriver extends DibiObject implements IDibiDriver, IDibiResultDriver
$this->connection = new PDO($config['dsn'], $config['username'], $config['password'], $config['options']);
} catch (PDOException $e) {
if ($e->getMessage() === 'could not find driver') {
throw new DibiNotSupportedException("PHP extension for PDO is not loaded.");
}
throw new DibiDriverException($e->getMessage(), $e->getCode());
}
if (!$this->connection) {
throw new DibiDriverException('Connecting error.');
}
$this->driverName = $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME);
}