ErrorHandler

Type
Class
Namespace
craft\web
Inherits
craft\web\ErrorHandler » yii\web\ErrorHandler (opens new window) » yii\base\ErrorHandler (opens new window) » yii\base\Component (opens new window) » yii\base\BaseObject (opens new window)
Implements
yii\base\Configurable (opens new window)
Since
3.0.0

Class ErrorHandler

View source (opens new window)

# Public Properties

Property Description
behaviors (opens new window) yii\base\Behavior (opens new window) – List of behaviors attached to this component
callStackItemView (opens new window) string (opens new window) – The path of the view file for rendering exceptions and errors call stack element.
discardExistingOutput (opens new window) boolean (opens new window) – Whether to discard any existing page output before error display.
displayVars (opens new window) array (opens new window) – List of the PHP predefined variables that should be displayed on the error page.
errorAction (opens new window) string (opens new window) – The route (e.g. site/error) to the controller action that will be used to display external errors.
errorView (opens new window) string (opens new window) – The path of the view file for rendering exceptions without call stack information.
exception (opens new window) Exception (opens new window), null (opens new window) – The exception that is being handled currently.
exceptionView (opens new window) string (opens new window) – The path of the view file for rendering exceptions.
maxSourceLines (opens new window) integer (opens new window) – Maximum number of source code lines to be displayed.
maxTraceSourceLines (opens new window) integer (opens new window) – Maximum number of trace source code lines to be displayed.
memoryReserveSize (opens new window) integer (opens new window) – The size of the reserved memory.
previousExceptionView (opens new window) string (opens new window) – The path of the view file for rendering previous exceptions.
silentExitOnException (opens new window) boolean (opens new window) – If true - handleException() will finish script with ExitCode::OK.
traceLine (opens new window) string (opens new window) – Trace line with placeholders to be be substituted.

# Public Methods

Method Description
__call() (opens new window) Calls the named method which is not a class method.
__clone() (opens new window) This method is called after the object is created by cloning an existing one.
__construct() (opens new window) Constructor.
__get() (opens new window) Returns the value of an object property.
__isset() (opens new window) Checks if a property is set, i.e. defined and not null.
__set() (opens new window) Sets value of an object property.
__unset() (opens new window) Sets an object property to null.
addTypeLinks() (opens new window) Adds informational links to the given PHP type/class.
argumentsToString() (opens new window) Converts arguments array to its string representation.
attachBehavior() (opens new window) Attaches a behavior to this component.
attachBehaviors() (opens new window) Attaches a list of behaviors to the component.
behaviors() (opens new window) Returns a list of behaviors that this component should behave as.
canGetProperty() (opens new window) Returns a value indicating whether a property can be read.
canSetProperty() (opens new window) Returns a value indicating whether a property can be set.
className() (opens new window) Returns the fully qualified name of this class.
clearOutput() (opens new window) Removes all output echoed before calling this method.
convertExceptionToError() (opens new window) Converts an exception into a PHP error.
convertExceptionToString() (opens new window) Converts an exception into a simple string.
convertExceptionToVerboseString() (opens new window) Converts an exception into a string that has verbose information about the exception and its trace.
createFrameworkVersionLink() (opens new window) Creates string containing HTML link which refers to the page with the current version of the framework and version number text.
createHttpStatusLink() (opens new window) Creates HTML containing link to the page with the information on given HTTP status code.
createServerInformationLink() (opens new window) Creates string containing HTML link which refers to the home page of determined web-server software and its full name.
detachBehavior() (opens new window) Detaches a behavior from the component.
detachBehaviors() (opens new window) Detaches all behaviors from the component.
ensureBehaviors() (opens new window) Makes sure that the behaviors declared in behaviors() (opens new window) are attached to this component.
getBehavior() (opens new window) Returns the named behavior object.
getBehaviors() (opens new window) Returns all behaviors attached to this component.
getExceptionName() Returns human-readable exception name.
handleError() Handles PHP execution errors such as warnings and notices.
handleException() Handles uncaught PHP exceptions.
handleFatalError() (opens new window) Handles fatal PHP errors.
handleHhvmError() (opens new window) Handles HHVM execution errors such as warnings and notices.
hasEventHandlers() (opens new window) Returns a value indicating whether there is any handler attached to the named event.
hasMethod() (opens new window) Returns a value indicating whether a method is defined.
hasProperty() (opens new window) Returns a value indicating whether a property is defined.
htmlEncode() (opens new window) Converts special characters to HTML entities.
init() (opens new window)
isCoreFile() Determines whether given name of the file belongs to the framework.
logException() (opens new window) Logs the given exception.
off() (opens new window) Detaches an existing event handler from this component.
on() (opens new window) Attaches an event handler to an event.
register() (opens new window) Register this error handler.
renderCallStack() (opens new window) Renders call stack.
renderCallStackItem() Renders a single call stack element.
renderFile() (opens new window) Renders a view file as a PHP script.
renderPreviousExceptions() (opens new window) Renders the previous exception stack for a given Exception.
renderRequest() (opens new window) Renders the global variables of the request.
trigger() (opens new window) Triggers an event.
unregister() (opens new window) Unregisters this error handler by restoring the PHP error and exception handlers.

# getExceptionName()

Returns human-readable exception name.

View source (opens new window)

Arguments

Returns

string (opens new window) – Human-readable exception name or null if it cannot be determined

# handleError()

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.

View source (opens new window)

Arguments

Returns

boolean (opens new window) – Whether the normal error handler continues.

Throws

# handleException()

Handles uncaught PHP exceptions.

This method is implemented as a PHP exception handler.

View source (opens new window)

Arguments

# isCoreFile()

Determines whether given name of the file belongs to the framework.

View source (opens new window)

Arguments

Returns

boolean (opens new window) – Whether given name of the file belongs to the framework.

# renderCallStackItem()

Renders a single call stack element.

View source (opens new window)

Arguments

Returns

string (opens new window) – HTML content of the rendered call stack element.

# Protected Methods

Method Description
convertExceptionToArray() (opens new window) Converts an exception into an array.
getTypeUrl() Returns the informational link URL for a given PHP type/class.
handleFallbackExceptionMessage() (opens new window) Handles exception thrown during exception processing in handleException() (opens new window).
renderException() Renders the exception.
shouldRenderSimpleHtml()

# getTypeUrl()

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

View source (opens new window)

Arguments

Returns

string (opens new window), null (opens new window) – The informational link URL.

# renderException()

Renders the exception.

View source (opens new window)

Arguments

# shouldRenderSimpleHtml()

Since
3.4.10

View source (opens new window)

Returns

boolean (opens new window) – If simple HTML should be rendered

# Events

# EVENT_BEFORE_HANDLE_EXCEPTION

Type
craft\events\ExceptionEvent

The event that is triggered before handling an exception.