From 0683dc43ff657dcf0f45793178ee71c2aa55a18c Mon Sep 17 00:00:00 2001 From: mark_story <mark@mark-story.com> Date: Fri, 27 Aug 2010 23:54:22 -0400 Subject: [PATCH] Replacing cakeError calls with exceptions in ConnectionManager and Model. --- cake/libs/model/connection_manager.php | 6 +++++- cake/libs/model/model.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cake/libs/model/connection_manager.php b/cake/libs/model/connection_manager.php index 34a355108..3011cb740 100644 --- a/cake/libs/model/connection_manager.php +++ b/cake/libs/model/connection_manager.php @@ -222,7 +222,7 @@ class ConnectionManager { $this->_connectionsEnum[$name] = $this->__connectionData($config); } } else { - $this->cakeError('missingConnection', array(array('className' => 'ConnectionManager'))); + throw new MissingConnectionException('ConnectionManager'); } } @@ -274,3 +274,7 @@ class ConnectionManager { } } } + + +class MissingDatabaseException extends RuntimeException {} +class MissingConnectionException extends RuntimeException {} \ No newline at end of file diff --git a/cake/libs/model/model.php b/cake/libs/model/model.php index fcb0f122e..04639668b 100644 --- a/cake/libs/model/model.php +++ b/cake/libs/model/model.php @@ -2825,7 +2825,7 @@ class Model extends Object { } if (empty($db) || !is_object($db)) { - return $this->cakeError('missingConnection', array(array('className' => $this->alias))); + throw new MissingConnectionException($this->useDbConfig); } }