From cc8d44f21f261c880284652d4afe67724c20db62 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 3 Sep 2011 17:03:11 +0100 Subject: [PATCH] Adding an exception for when a PDO interface is not installed. --- lib/Cake/Error/exceptions.php | 2 +- lib/Cake/Model/Datasource/DboSource.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Error/exceptions.php b/lib/Cake/Error/exceptions.php index 3b79a3c89ac..65b4fb5ab67 100644 --- a/lib/Cake/Error/exceptions.php +++ b/lib/Cake/Error/exceptions.php @@ -324,7 +324,7 @@ class MissingDatabaseException extends CakeException { * @package Cake.Error */ class MissingConnectionException extends CakeException { - protected $_messageTemplate = 'Database connection "%s" is missing.'; + protected $_messageTemplate = 'Database connection "%s" is missing, or could not be created.'; } /** diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php index 8adab3bbb06..63ddf8271db 100644 --- a/lib/Cake/Model/Datasource/DboSource.php +++ b/lib/Cake/Model/Datasource/DboSource.php @@ -243,7 +243,9 @@ public function __construct($config = null, $autoConnect = true) { parent::__construct($config); $this->fullDebug = Configure::read('debug') > 1; if (!$this->enabled()) { - return; + throw new MissingConnectionException(array( + 'class' => get_class($this) + )); } if ($autoConnect) { $this->connect();