Skip to content

Commit

Permalink
Automatically select the App ErrorController.
Browse files Browse the repository at this point in the history
If the application implements an ErrorController, use that instead of
the core one. This provides an easy convention based way for developers
to customize error handling. If you need plugin controllers, you'll
still have to override the renderer as well.

Refs cakephp/docs#2112
  • Loading branch information
markstory committed Dec 13, 2014
1 parent 30dd298 commit 0ed359b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Error/ExceptionRenderer.php
Expand Up @@ -15,7 +15,7 @@
namespace Cake\Error;

use Cake\Controller\Controller;
use Cake\Controller\ErrorController;
use Cake\Core\App;
use Cake\Core\Configure;
use Cake\Core\Exception\Exception as CakeException;
use Cake\Core\Exception\MissingPluginException;
Expand Down Expand Up @@ -104,7 +104,8 @@ protected function _getController() {
$response = new Response();

try {
$controller = new ErrorController($request, $response);
$class = App::className('Error', 'Controller', 'Controller');
$controller = new $class($request, $response);
$controller->startupProcess();
} catch (Exception $e) {
if (!empty($controller) && isset($controller->RequestHandler)) {
Expand Down

0 comments on commit 0ed359b

Please sign in to comment.