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.
_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
string
_logError( string $level , array $data )
Log an error.
$level
$data
boolean
_logException( Exception $exception )
Handles exception logging
$exception
boolean
_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 boolean
handleException( Exception $exception )
Handle uncaught exceptions.
Uses a template method provided by subclasses to display errors in an environment appropriate way.
$exception
Exception
handleFatalError( integer $code , string $description , string $file , integer $line )
Display/Log a fatal error.
$code
$description
$file
$line
boolean
mapErrorCode( integer $code )
Map an error code into an Error word, and log location.
$code
array
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–2016 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.
http://api.cakephp.org/3.1/class-Cake.Error.BaseErrorHandler.html