Skip to content
Permalink
Browse files

Controller\Error -> Controller\Exception

Also moved MissingControllerException to Router, as it has a better home there
  • Loading branch information...
lorenzo committed Aug 30, 2014
1 parent cb83b3f commit 22f90f767cd1d34eb73d338c9187bc2ebebd6ac5
@@ -14,9 +14,10 @@
*/
namespace Cake\Controller;
use Cake\Controller\Exception\MissingComponentException;
use Cake\Core\App;
use Cake\Event\EventManagerTrait;
use Cake\Core\ObjectRegistry;
use Cake\Event\EventManagerTrait;
/**
* ComponentRegistry is a registry for loaded components
@@ -75,10 +76,10 @@ protected function _resolveClassName($class) {
* @param string $class The classname that is missing.
* @param string $plugin The plugin the component is missing in.
* @return void
* @throws \Cake\Controller\Error\MissingComponentException
* @throws \Cake\Controller\Exception\MissingComponentException
*/
protected function _throwMissingClassError($class, $plugin) {
throw new Error\MissingComponentException([
throw new MissingComponentException([
'class' => $class . 'Component',
'plugin' => $plugin
]);
@@ -14,7 +14,8 @@
*/
namespace Cake\Controller;
use Cake\Core\Exception\Exception;
use Cake\Controller\Exception\MissingActionException;
use Cake\Controller\Exception\PrivateActionException;
use Cake\Event\Event;
use Cake\Event\EventListener;
use Cake\Event\EventManagerTrait;
@@ -352,8 +353,8 @@ public function setRequest(Request $request) {
*
* @return mixed The resulting response.
* @throws \LogicException When request is not set.
* @throws \Cake\Controller\Error\PrivateActionException When actions are not public or prefixed by _
* @throws \Cake\Controller\Error\MissingActionException When actions are not defined.
* @throws \Cake\Controller\Exception\PrivateActionException When actions are not public or prefixed by _
* @throws \Cake\Controller\Exception\MissingActionException When actions are not defined.
*/
public function invokeAction() {
try {
@@ -363,7 +364,7 @@ public function invokeAction() {
}
$method = new \ReflectionMethod($this, $request->params['action']);
if ($this->_isPrivateAction($method, $request)) {
throw new Error\PrivateActionException(array(
throw new PrivateActionException(array(
'controller' => $this->name . "Controller",
'action' => $request->params['action'],
'prefix' => isset($request->params['prefix']) ? $request->params['prefix'] : '',
@@ -373,7 +374,7 @@ public function invokeAction() {
return $method->invokeArgs($this, $request->params['pass']);
} catch (\ReflectionException $e) {
throw new Error\MissingActionException(array(
throw new MissingActionException(array(
'controller' => $this->name . "Controller",
'action' => $request->params['action'],
'prefix' => isset($request->params['prefix']) ? $request->params['prefix'] : '',
@@ -11,7 +11,7 @@
* @since 3.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Controller\Error;
namespace Cake\Controller\Exception;
use Cake\Core\Exception\Exception;
@@ -11,7 +11,7 @@
* @since 3.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Controller\Error;
namespace Cake\Controller\Exception;
use Cake\Core\Exception\Exception;
@@ -13,7 +13,7 @@
* @since 3.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Controller\Error;
namespace Cake\Controller\Exception;
use Cake\Core\Exception\Exception;
@@ -15,13 +15,13 @@
namespace Cake\Routing;
use Cake\Controller\Controller;
use Cake\Controller\Error\MissingControllerException;
use Cake\Core\Exception\Exception;
use Cake\Event\Event;
use Cake\Event\EventListener;
use Cake\Event\EventManagerTrait;
use Cake\Network\Request;
use Cake\Network\Response;
use Cake\Routing\Error\MissingControllerException;
use LogicException;
/**
* Dispatcher converts Requests into controller actions. It uses the dispatched Request
@@ -55,7 +55,7 @@ class Dispatcher {
* @param \Cake\Network\Request $request Request object to dispatch.
* @param \Cake\Network\Response $response Response object to put the results of the dispatch into.
* @return string|void if `$request['return']` is set then it returns response body, null otherwise
* @throws \Cake\Controller\Error\MissingControllerException When the controller is missing.
* @throws \Cake\Routing\Error\MissingControllerException When the controller is missing.
*/
public function dispatch(Request $request, Response $response) {
$beforeEvent = new Event('Dispatcher.beforeDispatch', $this, compact('request', 'response'));
@@ -102,7 +102,7 @@ public function dispatch(Request $request, Response $response) {
*
* @param Controller $controller Controller to invoke
* @return \Cake\Network\Response The resulting response object
* @throws \Cake\Core\Exception\Exception If data returned by controller action is not an
* @throws \LogicException If data returned by controller action is not an
* instance of Response
*/
protected function _invoke(Controller $controller) {
@@ -114,7 +114,7 @@ protected function _invoke(Controller $controller) {
$response = $controller->invokeAction();
if ($response !== null && !($response instanceof Response)) {
throw new Exception('Controller action can only return an instance of Response');
throw new LogicException('Controller action can only return an instance of Response');
}
if (!$response && $controller->autoRender) {
@@ -11,7 +11,7 @@
* @since 3.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Controller\Error;
namespace Cake\Routing\Error;
use Cake\Core\Exception\Exception;
@@ -15,7 +15,7 @@
namespace Cake\Test\TestCase\Console;
use Cake\Console\ConsoleErrorHandler;
use Cake\Controller\Error\MissingActionException;
use Cake\Controller\Exception\MissingActionException;
use Cake\Core\Exception\Exception;
use Cake\Log\Log;
use Cake\Network\Exception\InternalErrorException;
@@ -116,7 +116,7 @@ public function testLoadWithEnableFalse() {
/**
* test missingcomponent exception
*
* @expectedException \Cake\Controller\Error\MissingComponentException
* @expectedException \Cake\Controller\Exception\MissingComponentException
* @return void
*/
public function testLoadMissingComponent() {
@@ -722,7 +722,7 @@ public function testPaginateUsesModelClass() {
/**
* testMissingAction method
*
* @expectedException \Cake\Controller\Error\MissingActionException
* @expectedException \Cake\Controller\Exception\MissingActionException
* @expectedExceptionMessage Action TestController::missing() could not be found.
* @return void
*/
@@ -738,7 +738,7 @@ public function testInvokeActionMissingAction() {
/**
* test invoking private methods.
*
* @expectedException \Cake\Controller\Error\PrivateActionException
* @expectedException \Cake\Controller\Exception\PrivateActionException
* @expectedExceptionMessage Private Action TestController::private_m() is not directly accessible.
* @return void
*/
@@ -754,7 +754,7 @@ public function testInvokeActionPrivate() {
/**
* test invoking protected methods.
*
* @expectedException \Cake\Controller\Error\PrivateActionException
* @expectedException \Cake\Controller\Exception\PrivateActionException
* @expectedExceptionMessage Private Action TestController::protected_m() is not directly accessible.
* @return void
*/
@@ -770,7 +770,7 @@ public function testInvokeActionProtected() {
/**
* test invoking hidden methods.
*
* @expectedException \Cake\Controller\Error\PrivateActionException
* @expectedException \Cake\Controller\Exception\PrivateActionException
* @expectedExceptionMessage Private Action TestController::_hidden() is not directly accessible.
* @return void
*/
@@ -786,7 +786,7 @@ public function testInvokeActionHidden() {
/**
* test invoking controller methods.
*
* @expectedException \Cake\Controller\Error\PrivateActionException
* @expectedException \Cake\Controller\Exception\PrivateActionException
* @expectedExceptionMessage Private Action TestController::redirect() is not directly accessible.
* @return void
*/
@@ -16,10 +16,9 @@
use Cake\Controller\Component;
use Cake\Controller\Controller;
use Cake\Controller\Error\MissingActionException;
use Cake\Controller\Error\MissingComponentException;
use Cake\Controller\Error\MissingControllerException;
use Cake\Controller\Error\PrivateActionException;
use Cake\Controller\Exception\MissingActionException;
use Cake\Controller\Exception\MissingComponentException;
use Cake\Controller\Exception\PrivateActionException;
use Cake\Core\App;
use Cake\Core\Configure;
use Cake\Core\Exception\MissingPluginException;
@@ -35,6 +34,7 @@
use Cake\Network\Exception\SocketException;
use Cake\Network\Request;
use Cake\ORM\Error\MissingBehaviorException;
use Cake\Routing\Error\MissingControllerException;
use Cake\Routing\Router;
use Cake\TestSuite\TestCase;
use Cake\View\Error\MissingHelperException;
@@ -14,8 +14,6 @@
namespace Cake\Test\TestCase\Routing;
use Cake\Controller\Controller;
use Cake\Controller\Error\MissingActionException;
use Cake\Controller\Error\MissingControllerException;
use Cake\Core\App;
use Cake\Core\Configure;
use Cake\Core\Plugin;
@@ -234,7 +232,7 @@ public function tearDown() {
/**
* testMissingController method
*
* @expectedException \Cake\Controller\Error\MissingControllerException
* @expectedException \Cake\Routing\Error\MissingControllerException
* @expectedExceptionMessage Controller class SomeController could not be found.
* @return void
*/
@@ -253,7 +251,7 @@ public function testMissingController() {
/**
* testMissingControllerInterface method
*
* @expectedException \Cake\Controller\Error\MissingControllerException
* @expectedException \Cake\Routing\Error\MissingControllerException
* @expectedExceptionMessage Controller class DispatcherTestInterface could not be found.
* @return void
*/
@@ -273,7 +271,7 @@ public function testMissingControllerInterface() {
/**
* testMissingControllerInterface method
*
* @expectedException \Cake\Controller\Error\MissingControllerException
* @expectedException \Cake\Routing\Error\MissingControllerException
* @expectedExceptionMessage Controller class Abstract could not be found.
* @return void
*/
@@ -261,7 +261,7 @@ public function testTestActionWithPlugin() {
/**
* Tests not using loaded routes during tests
*
* @expectedException \Cake\Controller\Error\MissingActionException
* @expectedException \Cake\Controller\Exception\MissingActionException
* @return void
*/
public function testSkipRoutes() {

0 comments on commit 22f90f7

Please sign in to comment.
You can’t perform that action at this time.