Moving calls of cakeError() to using exceptions.

This commit is contained in:
mark_story 2010-08-27 22:59:48 -04:00
parent 1980c924b9
commit a15c4f89b4

View file

@ -116,12 +116,7 @@ class Dispatcher extends Object {
if (!is_object($controller)) { if (!is_object($controller)) {
Router::setRequestInfo(array($this->params, array('base' => $this->base, 'webroot' => $this->webroot))); Router::setRequestInfo(array($this->params, array('base' => $this->base, 'webroot' => $this->webroot)));
return $this->cakeError('missingController', array(array( throw new MissingControllerException($this->params['controller'] . 'Controller');
'className' => Inflector::camelize($this->params['controller']) . 'Controller',
'webroot' => $this->webroot,
'url' => $url,
'base' => $this->base
)));
} }
$privateAction = $this->params['action'][0] === '_'; $privateAction = $this->params['action'][0] === '_';
$prefixes = Router::prefixes(); $prefixes = Router::prefixes();
@ -140,13 +135,12 @@ class Dispatcher extends Object {
)); ));
if ($privateAction) { if ($privateAction) {
return $this->cakeError('privateAction', array(array( $message = sprintf(
'className' => Inflector::camelize($this->params['controller'] . "Controller"), '%s::%s()',
'action' => $this->params['action'], Inflector::camelize($this->params['controller']) . "Controller",
'webroot' => $this->webroot, $this->params['action']
'url' => $url, );
'base' => $this->base throw new PrivateActionException($message);
)));
} }
$controller->base = $this->base; $controller->base = $this->base;
$controller->here = $this->here; $controller->here = $this->here;
@ -191,13 +185,12 @@ class Dispatcher extends Object {
App::import('Controller', 'Scaffold', false); App::import('Controller', 'Scaffold', false);
return new Scaffold($controller, $params); return new Scaffold($controller, $params);
} }
return $this->cakeError('missingAction', array(array( $message = sprintf(
'className' => Inflector::camelize($params['controller']."Controller"), '%s::%s',
'action' => $params['action'], Inflector::camelize($params['controller']) . "Controller",
'webroot' => $this->webroot, $params['action']
'url' => $this->here, );
'base' => $this->base throw new MissingActionException($message);
)));
} }
$output = call_user_func_array(array(&$controller, $params['action']), $params['pass']); $output = call_user_func_array(array(&$controller, $params['action']), $params['pass']);