diff --git a/lib/Cake/Error/exceptions.php b/lib/Cake/Error/exceptions.php index 3b79a3c89..65b4fb5ab 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 8adab3bbb..63ddf8271 100644 --- a/lib/Cake/Model/Datasource/DboSource.php +++ b/lib/Cake/Model/Datasource/DboSource.php @@ -243,7 +243,9 @@ class DboSource extends DataSource { 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();