Craft 3 Class Reference

Class craft\web\ErrorHandler

Inheritance
craft\web\ErrorHandler » yii\web\ErrorHandler » yii\base\ErrorHandler » yii\base\Component » yii\base\BaseObject
Implements
yii\base\Configurable
Available since version
3.0
Source Code
https://github.com/craftcms/cms/blob/master/src/web/ErrorHandler.php

Class ErrorHandler

Public Properties
Property Type Description Defined By
$callStackItemView string The path of the view file for rendering exceptions and errors call stack element. yii\web\ErrorHandler
$discardExistingOutput boolean Whether to discard any existing page output before error display. yii\base\ErrorHandler
$displayVars array List of the PHP predefined variables that should be displayed on the error page. yii\web\ErrorHandler
$errorAction string The route (e.g. site/error) to the controller action that will be used to display external errors. yii\web\ErrorHandler
$errorView string The path of the view file for rendering exceptions without call stack information. yii\web\ErrorHandler
$exception Exception, null The exception that is being handled currently. yii\base\ErrorHandler
$exceptionView string The path of the view file for rendering exceptions. yii\web\ErrorHandler
$maxSourceLines integer Maximum number of source code lines to be displayed. yii\web\ErrorHandler
$maxTraceSourceLines integer Maximum number of trace source code lines to be displayed. yii\web\ErrorHandler
$memoryReserveSize integer The size of the reserved memory. yii\base\ErrorHandler
$previousExceptionView string The path of the view file for rendering previous exceptions. yii\web\ErrorHandler
$traceLine string Trace line with placeholders to be be substituted. yii\web\ErrorHandler
Public Methods
Method Description Defined By
__call() Calls the named method which is not a class method. yii\base\BaseObject
__clone() This method is called after the object is created by cloning an existing one. yii\base\Component
__construct() Constructor. yii\base\BaseObject
__get() Returns the value of an object property. yii\base\BaseObject
__isset() Checks if a property is set, i.e. defined and not null. yii\base\BaseObject
__set() Sets value of an object property. yii\base\BaseObject
__unset() Sets an object property to null. yii\base\BaseObject
addTypeLinks() Adds informational links to the given PHP type/class. yii\web\ErrorHandler
argumentsToString() Converts arguments array to its string representation. yii\web\ErrorHandler
attachBehavior() Attaches a behavior to this component. yii\base\Component
attachBehaviors() Attaches a list of behaviors to the component. yii\base\Component
behaviors() Returns a list of behaviors that this component should behave as. yii\base\Component
canGetProperty() Returns a value indicating whether a property can be read. yii\base\BaseObject
canSetProperty() Returns a value indicating whether a property can be set. yii\base\BaseObject
className() Returns the fully qualified name of this class. yii\base\BaseObject
clearOutput() Removes all output echoed before calling this method. yii\base\ErrorHandler
convertExceptionToError() Converts an exception into a PHP error. yii\base\ErrorHandler
convertExceptionToString() Converts an exception into a simple string. yii\base\ErrorHandler
convertExceptionToVerboseString() Converts an exception into a string that has verbose information about the exception and its trace. yii\base\ErrorHandler
createFrameworkVersionLink() Creates string containing HTML link which refers to the page with the current version of the framework and version number text. yii\web\ErrorHandler
createHttpStatusLink() Creates HTML containing link to the page with the information on given HTTP status code. yii\web\ErrorHandler
createServerInformationLink() Creates string containing HTML link which refers to the home page of determined web-server software and its full name. yii\web\ErrorHandler
detachBehavior() Detaches a behavior from the component. yii\base\Component
detachBehaviors() Detaches all behaviors from the component. yii\base\Component
ensureBehaviors() Makes sure that the behaviors declared in behaviors() are attached to this component. yii\base\Component
getBehavior() Returns the named behavior object. yii\base\Component
getBehaviors() Returns all behaviors attached to this component. yii\base\Component
getExceptionName() Returns human-readable exception name. craft\web\ErrorHandler
handleError() Handles PHP execution errors such as warnings and notices. craft\web\ErrorHandler
handleException() Handles uncaught PHP exceptions. craft\web\ErrorHandler
handleFatalError() Handles fatal PHP errors. yii\base\ErrorHandler
handleHhvmError() Handles HHVM execution errors such as warnings and notices. yii\base\ErrorHandler
hasEventHandlers() Returns a value indicating whether there is any handler attached to the named event. yii\base\Component
hasMethod() Returns a value indicating whether a method is defined. yii\base\BaseObject
hasProperty() Returns a value indicating whether a property is defined. yii\base\BaseObject
htmlEncode() Converts special characters to HTML entities. yii\web\ErrorHandler
init() Initializes the object. yii\base\BaseObject
isCoreFile() Determines whether given name of the file belongs to the framework. yii\web\ErrorHandler
logException() Logs the given exception. yii\base\ErrorHandler
off() Detaches an existing event handler from this component. yii\base\Component
on() Attaches an event handler to an event. yii\base\Component
register() Register this error handler. yii\base\ErrorHandler
renderCallStack() Renders call stack. yii\web\ErrorHandler
renderCallStackItem() Renders a single call stack element. craft\web\ErrorHandler
renderFile() Renders a view file as a PHP script. yii\web\ErrorHandler
renderPreviousExceptions() Renders the previous exception stack for a given Exception. yii\web\ErrorHandler
renderRequest() Renders the global variables of the request. yii\web\ErrorHandler
trigger() Triggers an event. yii\base\Component
unregister() Unregisters this error handler by restoring the PHP error and exception handlers. yii\base\ErrorHandler
Protected Methods
Method Description Defined By
convertExceptionToArray() Converts an exception into an array. yii\web\ErrorHandler
getTypeUrl() Returns the informational link URL for a given PHP type/class. craft\web\ErrorHandler
handleFallbackExceptionMessage() Handles exception thrown during exception processing in handleException(). yii\base\ErrorHandler
renderException() Renders the exception. craft\web\ErrorHandler
shouldRenderSimpleHtml() yii\web\ErrorHandler
Events
Event Type Description Defined By
EVENT_BEFORE_HANDLE_EXCEPTION craft\events\ExceptionEvent The event that is triggered before handling an exception. craft\web\ErrorHandler

Method Details

getExceptionName() public method #

Returns human-readable exception name.

public string getExceptionName ( $exception )
$exception Exception
return string Human-readable exception name or null if it cannot be determined

getTypeUrl() protected method #

Returns the informational link URL for a given PHP type/class.

protected string, null getTypeUrl ( $class, $method )
$class string The type or class name.
$method string, null The method name.
return string, null The informational link URL.

handleError() public method #

Handles PHP execution errors such as warnings and notices.

This method is used as a PHP error handler. It will simply raise an \craft\web\ErrorException.

public boolean handleError ( $code, $message, $file, $line )
$code integer The level of the error raised.
$message string The error message.
$file string The filename that the error was raised in.
$line integer The line number the error was raised at.
return boolean Whether the normal error handler continues.
throws yii\base\ErrorException

handleException() public method #

Handles uncaught PHP exceptions.

This method is implemented as a PHP exception handler.

public void handleException ( $exception )
$exception Exception The exception that is not caught

renderCallStackItem() public method #

Renders a single call stack element.

public string renderCallStackItem ( $file, $line, $class, $method, $args, $index )
$file string, null Name where call has happened.
$line integer, null Number on which call has happened.
$class string, null Called class name.
$method string, null Called function/method name.
$args array Array of method arguments.
$index integer Number of the call stack element.
return string HTML content of the rendered call stack element.

renderException() protected method #

Renders the exception.

protected void renderException ( $exception )
$exception Exception, Error The exception to be rendered.

Event Details

EVENT_BEFORE_HANDLE_EXCEPTION event of type craft\events\ExceptionEvent #

The event that is triggered before handling an exception.