Base error handler that provides logic common to the CLI + web error/exception handlers.
Subclasses are required to implement the template methods to handle displaying the errors in their environment.
$_options
protected array
Increases the PHP "memory_limit" ini setting by the specified amount in kilobytes
Checks the passed exception type. If it is an instance of Error
then, it wraps the passed object inside another Exception object for backwards compatibility purposes.
_displayError( array $error , boolean $debug )
Display an error message in an environment specific way.
Subclasses should implement this method to display the error as desired for the runtime they operate in.
$error
$debug
_displayException( Exception $exception )
Display an exception in an environment specific way.
Subclasses should implement this method to display an uncaught exception as desired for the runtime they operate in.
$exception
_getMessage( Exception $exception )
Generates a formatted error message
$exception
_logError( string $level , array $data )
Log an error.
$level
$data
_logException( Exception $exception )
Handles exception logging
$exception
_requestContext( Cake\Http\ServerRequest $request )
Get the request context for an error/exception trace.
Cake\Http\ServerRequest
$request
_stop( integer $code )
Stop the process.
Implemented in subclasses that need it.
$code
handleError( integer $code , string $description , string|null $file null , integer|null $line null , array|null $context null )
Set as the default error handler by CakePHP.
Use config/error.php to customize or replace this error handler. This function will use Debugger to display errors when debug > 0. And will log errors to Log, when debug == 0.
You can use the 'errorLevel' option to set what type of errors will be handled. Stack traces for errors can be enabled with the 'trace' option.
$code
$description
$file
optional null $line
optional null $context
optional null handleException( Exception $exception )
Handle uncaught exceptions.
Uses a template method provided by subclasses to display errors in an environment appropriate way.
$exception
handleFatalError( integer $code , string $description , string $file , integer $line )
Display/Log a fatal error.
$code
$description
$file
$line
increaseMemoryLimit( integer $additionalKb )
Increases the PHP "memory_limit" ini setting by the specified amount in kilobytes
$additionalKb
mapErrorCode( integer $code )
Map an error code into an Error word, and log location.
$code
wrapAndHandleException( Exception|Error $exception )
Checks the passed exception type. If it is an instance of Error
then, it wraps the passed object inside another Exception object for backwards compatibility purposes.
$exception
© 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.BaseErrorHandler.html