Skip to content

Commit

Permalink
Remove Controller::appError()
Browse files Browse the repository at this point in the history
This vestigal method from 1.x is no longer necessary. The current
exception/error handling tools are very flexible and this third way to
do things is confusing and not necessary.
  • Loading branch information
markstory committed Aug 22, 2013
1 parent 2fb5cdf commit 7c063c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 31 deletions.
7 changes: 0 additions & 7 deletions lib/Cake/Error/ErrorHandler.php
Expand Up @@ -38,7 +38,6 @@
* gives you different amounts of control over the exception handling process.
*
* - Modify App/Config/error.php and setup custom exception handling.
* - Create AppController::appError();
* - Use the `exceptionRenderer` option to inject an Exception renderer. This will
* let you keep the existing handling logic but override the rendering logic.
*
Expand All @@ -47,12 +46,6 @@
* This gives you full control over the exception handling process. The class you choose should be
* loaded in your app/Config/error.php and registered as the default exception handler.
*
* #### Using `AppController::appError();`
*
* This controller method is called instead of the default exception rendering. It receives the
* thrown exception as its only argument. You should implement your error handling in that method.
* Using AppController::appError(), will supersede any default exception handlers.
*
* #### Using a custom renderer with `exceptionRenderer`
*
* If you don't want to take control of the exception handling, but want to change how exceptions are
Expand Down
28 changes: 4 additions & 24 deletions lib/Cake/Error/ExceptionRenderer.php
@@ -1,10 +1,5 @@
<?php
/**
* Exception Renderer
*
* Provides Exception rendering features. Which allow exceptions to be rendered
* as HTML pages.
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
Expand All @@ -16,7 +11,6 @@
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package Cake.Error
* @since CakePHP(tm) v 2.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
Expand All @@ -31,7 +25,6 @@
use Cake\Network\Response;
use Cake\Routing\Router;
use Cake\Utility\Inflector;
use Cake\Utility\Sanitize;
use Cake\View\View;

/**
Expand All @@ -43,23 +36,13 @@
*
* ### Implementing application specific exception rendering
*
* You can implement application specific exception handling in one of a few ways:
*
* - Create a AppController::appError();
* - Create a subclass of ExceptionRenderer and configure it to be the `Exception.renderer`
*
* #### Using AppController::appError();
*
* This controller method is called instead of the default exception handling. It receives the
* thrown exception as its only argument. You should implement your error handling in that method.
* You can implement application specific exception handling by creating a subclass of
* ExceptionRenderer and configure it to be the `exceptionRenderer` in App/Config/error.php
*
* #### Using a subclass of ExceptionRenderer
*
* Using a subclass of ExceptionRenderer gives you full control over how Exceptions are rendered, you
* can configure your class in your App/Config/error.php, with `Configure::write('Exception.renderer', 'MyClass');`
* You should place any custom exception renderers in `app/Lib/Error`.
*
* @package Cake.Error
* can configure your class in your App/Config/error.php.
*/
class ExceptionRenderer {

Expand Down Expand Up @@ -97,14 +80,11 @@ class ExceptionRenderer {
* code error depending on the code used to construct the error.
*
* @param \Exception $exception Exception
* @return mixed Return void or value returned by controller's `appError()` function
* @return void
*/
public function __construct(\Exception $exception) {
$this->controller = $this->_getController($exception);

if (method_exists($this->controller, 'apperror')) {
return $this->controller->appError($exception);
}
list(, $baseClass) = namespaceSplit(get_class($exception));
$baseClass = substr($baseClass, 0, -9);
$method = $template = Inflector::variable($baseClass);
Expand Down

0 comments on commit 7c063c3

Please sign in to comment.