Exception Renderer.
Captures and handles all unhandled exceptions. Displays helpful framework errors when debug is true. When debug is false a CakeException will render 404 or 500 errors. If an uncaught exception is thrown and it is a type that ExceptionHandler does not know about it will be treated as a 500 error.
You can implement application specific exception handling by creating a subclass of ExceptionRenderer and configure it to be the exceptionRenderer
in config/error.php
Using a subclass of ExceptionRenderer gives you full control over how Exceptions are rendered, you can configure your class in your config/app.php.
$controller
public $error
public Exception
$method
public string
$template
public string
Creates the controller to perform rendering on the error response. If the error is a Cake\Core\Exception\Exception it will be converted to either a 400 or a 500 code error depending on the code used to construct the error.
Get the controller instance to handle the exception. Override this method in subclasses to customize the controller used. This method returns the built in ErrorController
normally, or if an error is repeated a bare controller will be used.
A safer way to render error messages, replaces all helpers, with basics and doesn't call component methods.
Returns the unwrapped exception object in case we are dealing with a PHP 7 Error object
__construct( Exception $exception )
Creates the controller to perform rendering on the error response. If the error is a Cake\Core\Exception\Exception it will be converted to either a 400 or a 500 code error depending on the code used to construct the error.
$exception
_code( Exception $exception )
Get an error code value within range 400 to 506
$exception
_customMethod( string $method , Exception $exception )
Render a custom error method/template.
$method
$exception
_getController( )
Get the controller instance to handle the exception. Override this method in subclasses to customize the controller used. This method returns the built in ErrorController
normally, or if an error is repeated a bare controller will be used.
Cake\Controller\Controller
_message( Exception $exception , integer $code )
Get error message.
$exception
$code
_method( Exception $exception )
Get method name
$exception
_outputMessage( string $template )
Generate the response using the controller object.
$template
_outputMessageSafe( string $template )
A safer way to render error messages, replaces all helpers, with basics and doesn't call component methods.
$template
_shutdown( )
Run the shutdown events.
Triggers the afterFilter and afterDispatch events.
_template( Exception $exception , string $method , integer $code )
Get template for rendering exception info.
$exception
$method
$code
_unwrap( Exception $exception )
Returns the unwrapped exception object in case we are dealing with a PHP 7 Error object
$exception
render( )
Renders the response for the exception.
Cake\Error\ExceptionRendererInterface::render()
© 2005–2017 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.4/class-Cake.Error.ExceptionRenderer.html