PHP 클래스 yii\base\ErrorHandler

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])
저자: Alexander Makarov ([email protected])
저자: Carsten Brandt ([email protected])
상속: extends Component
파일 보기 프로젝트 열기: yiisoft/yii2 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$discardExistingOutput whether to discard any existing page output before error display. Defaults to true.
$exception the exception that is being handled currently.
$memoryReserveSize the size of the reserved memory. A portion of memory is pre-allocated so that when an out-of-memory issue occurs, the error handler is able to handle the error with the help of this reserved memory. If you set this value to be 0, no memory will be reserved. Defaults to 256KB.

공개 메소드들

메소드 설명
clearOutput ( ) Removes all output echoed before calling this method.
convertExceptionToError ( Exception $exception ) Converts an exception into a PHP error.
convertExceptionToString ( Exception $exception ) : string Converts an exception into a simple string.
handleError ( integer $code, string $message, string $file, integer $line ) : boolean Handles PHP execution errors such as warnings and notices.
handleException ( Exception $exception ) Handles uncaught PHP exceptions.
handleFatalError ( ) Handles fatal PHP errors
handleHhvmError ( integer $code, string $message, string $file, integer $line, mixed $context, mixed $backtrace ) : boolean Handles HHVM execution errors such as warnings and notices.
logException ( Exception $exception ) Logs the given exception
register ( ) Register this error handler
unregister ( ) Unregisters this error handler by restoring the PHP error and exception handlers.

보호된 메소드들

메소드 설명
handleFallbackExceptionMessage ( Exception | Throwable $exception, Exception $previousException ) Handles exception thrown during exception processing in ErrorHandler::handleException.
renderException ( Exception $exception ) Renders the exception.

메소드 상세

clearOutput() 공개 메소드

Removes all output echoed before calling this method.
public clearOutput ( )

convertExceptionToError() 공개 정적인 메소드

This method can be used to convert exceptions inside of methods like __toString() to PHP errors because exceptions cannot be thrown inside of them.
public static convertExceptionToError ( Exception $exception )
$exception Exception the exception to convert to a PHP error.

convertExceptionToString() 공개 정적인 메소드

Converts an exception into a simple string.
public static convertExceptionToString ( Exception $exception ) : string
$exception Exception the exception being converted
리턴 string the string representation of the exception.

handleError() 공개 메소드

This method is used as a PHP error handler. It will simply raise an ErrorException.
public handleError ( integer $code, string $message, string $file, integer $line ) : boolean
$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.
리턴 boolean whether the normal error handler continues.

handleException() 공개 메소드

This method is implemented as a PHP exception handler.
public handleException ( Exception $exception )
$exception Exception the exception that is not caught

handleFallbackExceptionMessage() 보호된 메소드

Handles exception thrown during exception processing in ErrorHandler::handleException.
부터: 2.0.11
protected handleFallbackExceptionMessage ( Exception | Throwable $exception, Exception $previousException )
$exception Exception | Throwable Exception that was thrown during main exception processing.
$previousException Exception Main exception processed in [[handleException()]].

handleFatalError() 공개 메소드

Handles fatal PHP errors
public handleFatalError ( )

handleHhvmError() 공개 메소드

This method is used as a HHVM error handler. It will store exception that will be used in fatal error handler
부터: 2.0.6
public handleHhvmError ( integer $code, string $message, string $file, integer $line, mixed $context, mixed $backtrace ) : boolean
$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.
$context mixed
$backtrace mixed trace of error
리턴 boolean whether the normal error handler continues.

logException() 공개 메소드

Logs the given exception
부터: 2.0.3 this method is now public.
public logException ( Exception $exception )
$exception Exception the exception to be logged

register() 공개 메소드

Register this error handler
public register ( )

renderException() 추상적인 보호된 메소드

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

unregister() 공개 메소드

Unregisters this error handler by restoring the PHP error and exception handlers.
public unregister ( )

프로퍼티 상세

$discardExistingOutput 공개적으로 프로퍼티

whether to discard any existing page output before error display. Defaults to true.
public $discardExistingOutput

$exception 공개적으로 프로퍼티

the exception that is being handled currently.
public $exception

$memoryReserveSize 공개적으로 프로퍼티

the size of the reserved memory. A portion of memory is pre-allocated so that when an out-of-memory issue occurs, the error handler is able to handle the error with the help of this reserved memory. If you set this value to be 0, no memory will be reserved. Defaults to 256KB.
public $memoryReserveSize