From 100f978b9bf6337085d01d258f5e27c465e5c2da Mon Sep 17 00:00:00 2001 From: David Grudl Date: Mon, 12 Jan 2015 10:40:41 +0100 Subject: [PATCH] DibiPdoDriver: missing driver throws DibiNotSupportedException exception --- dibi/drivers/DibiPdoDriver.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dibi/drivers/DibiPdoDriver.php b/dibi/drivers/DibiPdoDriver.php index f37dd075..e0bc6d63 100644 --- a/dibi/drivers/DibiPdoDriver.php +++ b/dibi/drivers/DibiPdoDriver.php @@ -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); }