PHP Класс yii\web\ErrorHandler

ErrorHandler displays these errors using appropriate views based on the nature of the errors and the mode the application runs at. ErrorHandler is configured as an application component in Application by default. You can access that instance via Yii::$app->errorHandler. For more details and usage information on ErrorHandler, see the guide article on handling errors.
С версии: 2.0
Автор: Qiang Xue ([email protected])
Автор: Timur Ruziev ([email protected])
Наследование: extends yii\base\ErrorHandler
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$callStackItemView the path of the view file for rendering exceptions and errors call stack element.
$displayVars list of the PHP predefined variables that should be displayed on the error page. Note that a variable must be accessible via $GLOBALS. Otherwise it won't be displayed. Defaults to ['_GET', '_POST', '_FILES', '_COOKIE', '_SESSION'].
$errorAction the route (e.g. site/error) to the controller action that will be used to display external errors. Inside the action, it can retrieve the error information using Yii::$app->errorHandler->exception. This property defaults to null, meaning ErrorHandler will handle the error display.
$errorView the path of the view file for rendering exceptions without call stack information.
$exceptionView the path of the view file for rendering exceptions.
$maxSourceLines maximum number of source code lines to be displayed. Defaults to 19.
$maxTraceSourceLines maximum number of trace source code lines to be displayed. Defaults to 13.
$previousExceptionView the path of the view file for rendering previous exceptions.

Открытые методы

Метод Описание
addTypeLinks ( string $code ) : string Adds informational links to the given PHP type/class.
argumentsToString ( array $args ) : string Converts arguments array to its string representation
createFrameworkVersionLink ( ) : string Creates string containing HTML link which refers to the page with the current version of the framework and version number text.
createHttpStatusLink ( integer $statusCode, string $statusDescription ) : string Creates HTML containing link to the page with the information on given HTTP status code.
createServerInformationLink ( ) : string Creates string containing HTML link which refers to the home page of determined web-server software and its full name.
getExceptionName ( Exception $exception ) : string Returns human-readable exception name
htmlEncode ( string $text ) : string Converts special characters to HTML entities.
isCoreFile ( string $file ) : boolean Determines whether given name of the file belongs to the framework.
renderCallStackItem ( string | null $file, integer | null $line, string | null $class, string | null $method, array $args, integer $index ) : string Renders a single call stack element.
renderFile ( string $_file_, array $_params_ ) : string Renders a view file as a PHP script.
renderPreviousExceptions ( Exception $exception ) : string Renders the previous exception stack for a given Exception.
renderRequest ( ) : string Renders the global variables of the request.

Защищенные методы

Метод Описание
convertExceptionToArray ( Exception $exception ) : array Converts an exception into an array.
getTypeUrl ( string $class, string | null $method ) : string | null Returns the informational link URL for a given PHP type/class.
renderException ( Exception $exception ) Renders the exception.

Описание методов

argumentsToString() публичный Метод

Converts arguments array to its string representation
public argumentsToString ( array $args ) : string
$args array arguments array to be converted
Результат string string representation of the arguments array

convertExceptionToArray() защищенный Метод

Converts an exception into an array.
protected convertExceptionToArray ( Exception $exception ) : array
$exception Exception the exception being converted
Результат array the array representation of the exception.

getExceptionName() публичный Метод

Returns human-readable exception name
public getExceptionName ( Exception $exception ) : string
$exception Exception
Результат string human-readable exception name or null if it cannot be determined

getTypeUrl() защищенный Метод

Returns the informational link URL for a given PHP type/class.
См. также: addTypeLinks()
protected getTypeUrl ( string $class, string | null $method ) : string | null
$class string the type or class name.
$method string | null the method name.
Результат string | null the informational link URL.

htmlEncode() публичный Метод

Converts special characters to HTML entities.
public htmlEncode ( string $text ) : string
$text string to encode.
Результат string encoded original text.

isCoreFile() публичный Метод

Determines whether given name of the file belongs to the framework.
public isCoreFile ( string $file ) : boolean
$file string name to be checked.
Результат boolean whether given name of the file belongs to the framework.

renderCallStackItem() публичный Метод

Renders a single call stack element.
public renderCallStackItem ( string | null $file, integer | null $line, string | null $class, string | null $method, array $args, integer $index ) : string
$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.
Результат string HTML content of the rendered call stack element.

renderException() защищенный Метод

Renders the exception.
protected renderException ( Exception $exception )
$exception Exception the exception to be rendered.

renderFile() публичный Метод

Renders a view file as a PHP script.
public renderFile ( string $_file_, array $_params_ ) : string
$_file_ string the view file.
$_params_ array the parameters (name-value pairs) that will be extracted and made available in the view file.
Результат string the rendering result

renderPreviousExceptions() публичный Метод

Renders the previous exception stack for a given Exception.
public renderPreviousExceptions ( Exception $exception ) : string
$exception Exception the exception whose precursors should be rendered.
Результат string HTML content of the rendered previous exceptions. Empty string if there are none.

renderRequest() публичный Метод

List of global variables is defined in [[displayVars]].
См. также: displayVars
public renderRequest ( ) : string
Результат string the rendering result

Описание свойств

$callStackItemView публичное свойство

the path of the view file for rendering exceptions and errors call stack element.
public $callStackItemView

$displayVars публичное свойство

list of the PHP predefined variables that should be displayed on the error page. Note that a variable must be accessible via $GLOBALS. Otherwise it won't be displayed. Defaults to ['_GET', '_POST', '_FILES', '_COOKIE', '_SESSION'].
См. также: renderRequest()
С версии: 2.0.7
public $displayVars

$errorAction публичное свойство

the route (e.g. site/error) to the controller action that will be used to display external errors. Inside the action, it can retrieve the error information using Yii::$app->errorHandler->exception. This property defaults to null, meaning ErrorHandler will handle the error display.
public $errorAction

$errorView публичное свойство

the path of the view file for rendering exceptions without call stack information.
public $errorView

$exceptionView публичное свойство

the path of the view file for rendering exceptions.
public $exceptionView

$maxSourceLines публичное свойство

maximum number of source code lines to be displayed. Defaults to 19.
public $maxSourceLines

$maxTraceSourceLines публичное свойство

maximum number of trace source code lines to be displayed. Defaults to 13.
public $maxTraceSourceLines

$previousExceptionView публичное свойство

the path of the view file for rendering previous exceptions.
public $previousExceptionView