diff --git a/cake/libs/controller/scaffold.php b/cake/libs/controller/scaffold.php index a54a6f82b27..0190894541f 100644 --- a/cake/libs/controller/scaffold.php +++ b/cake/libs/controller/scaffold.php @@ -169,9 +169,7 @@ function __construct(&$controller, $params) { $this->modelKey = $controller->modelKey; if (!is_object($this->controller->{$this->modelClass})) { - return $this->cakeError('missingModel', array(array( - 'className' => $this->modelClass, 'webroot' => '', 'base' => $controller->base - ))); + throw new MissingModelException($this->modelClass); } $this->ScaffoldModel =& $this->controller->{$this->modelClass}; @@ -485,17 +483,11 @@ function __scaffold($params) { break; } } else { - return $this->cakeError('missingAction', array(array( - 'className' => $this->controller->name . "Controller", - 'base' => $this->controller->base, - 'action' => $this->action, - 'webroot' => $this->controller->webroot - ))); + $message = sprintf('%s::%s()', $this->controller->name . "Controller", $this->action); + throw new MissingActionException($message); } } else { - return $this->cakeError('missingDatabase', array(array( - 'webroot' => $this->controller->webroot - ))); + throw new MissingDatabaseException($this->ScaffoldModel->useDbConfig); } } @@ -605,6 +597,6 @@ protected function _getViewFileName($name = null) { return LIBS . 'view' . DS . 'errors' . DS . 'scaffold_error.ctp'; } - return $this->_missingView($paths[0] . $name . $this->ext, 'missingView'); + throw new MissingViewException($paths[0] . $name . $this->ext); } }