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