Bitrix API

ExceptionHandler

Table of Contents

Methods

__construct()  : mixed
ExceptionHandler constructor.
getTrackModules()  : array<string|int, mixed>
handleAssertion()  : void
Creates and exception object from its arguments.
handleError()  : true
Creates and exception object from its arguments.
handleException()  : void
Writes exception information into log, displays it to user and terminates with die().
handleFatalError()  : void
Gets error information from error_get_last() function.
initialize()  : void
Initializes error handling.
setAssertionErrorType()  : void
Sets assertion types to be handled.
setAssertionThrowsException()  : void
Whenever to throw an exception on assertion or not.
setDebugMode()  : void
Sets debug mode.
setExceptionErrorsTypes()  : void
Sets which errors will raise an exception.
setHandledErrorsTypes()  : void
Sets error types to be handled.
setHandlerLog()  : void
Sets logger object to use for log writing.
setHandlerOutput()  : void
Sets an object used for error message display to user.
setIgnoreSilence()  : void
Whenever to ignore error_reporting() == 0 or not.
setOverflowMemoryCatching()  : void
Whenever to try catch and report memory overflows errors or not.
setTrackModules()  : void
writeToLog()  : void
Writes an exception information to log.

Methods

__construct()

ExceptionHandler constructor.

public __construct() : mixed

getTrackModules()

public getTrackModules() : array<string|int, mixed>
Return values
array<string|int, mixed>

handleAssertion()

Creates and exception object from its arguments.

public handleAssertion(string $file, int $line, string $message) : void

Throws it if assertion set to raise exception (which is by default) or writes it to log.

Parameters
$file : string

File where error has occurred.

$line : int

File line number where error has occurred.

$message : string

Error message.

Tags
throws
ErrorException
see
ExceptionHandler::setAssertionThrowsException

handleError()

Creates and exception object from its arguments.

public handleError(int $code, string $message, string $file, int $line) : true

Throws it if $code matches exception mask or writes it into log.

Parameters
$code : int

Error code.

$message : string

Error message.

$file : string

File where error has occurred.

$line : int

File line number where error has occurred.

Tags
throws
ErrorException
see
ExceptionHandler::setExceptionErrorsTypes
Return values
true

handleException()

Writes exception information into log, displays it to user and terminates with die().

public handleException(Exception|Error $exception[, int $logType = ExceptionHandlerLog::UNCAUGHT_EXCEPTION ]) : void
Parameters
$exception : Exception|Error

Exception object.

$logType : int = ExceptionHandlerLog::UNCAUGHT_EXCEPTION
Tags
see
ExceptionHandler::writeToLog
see
ExceptionHandler::initialize

handleFatalError()

Gets error information from error_get_last() function.

public handleFatalError() : void

Checks if type for certain error types and writes it to log.

Tags
see
error_get_last
see
ExceptionHandler::setHandledErrorsTypes

initialize()

Initializes error handling.

public initialize(callable $exceptionHandlerOutputCreator[, callable|null $exceptionHandlerLogCreator = null ]) : void

Must be called after the object creation.

Parameters
$exceptionHandlerOutputCreator : callable

Function to return an object for error message formatting.

$exceptionHandlerLogCreator : callable|null = null

Function to return an object for log writing.

setAssertionThrowsException()

Whenever to throw an exception on assertion or not.

public setAssertionThrowsException(bool $assertionThrowsException) : void
Parameters
$assertionThrowsException : bool

If true an assertion will throw exception.

setDebugMode()

Sets debug mode.

public setDebugMode(bool $debug) : void

Should be used for development install.

Parameters
$debug : bool

If true errors will be displayed in html output. If false most errors will be suppressed.

setIgnoreSilence()

Whenever to ignore error_reporting() == 0 or not.

public setIgnoreSilence(bool $ignoreSilence) : void
Parameters
$ignoreSilence : bool

If true then error_reporting()==0 will be ignored.

setOverflowMemoryCatching()

Whenever to try catch and report memory overflows errors or not.

public setOverflowMemoryCatching(bool $catchOverflowMemory) : void
Parameters
$catchOverflowMemory : bool

If true memory overflow errors will be handled.

setTrackModules()

public setTrackModules(array<string|int, mixed> $trackModules) : void
Parameters
$trackModules : array<string|int, mixed>

writeToLog()

Writes an exception information to log.

public writeToLog(Throwable $exception[, int|null $logType = null ]) : void
Parameters
$exception : Throwable

Exception object.

$logType : int|null = null

See ExceptionHandlerLog class constants.

Tags
see
ExceptionHandler::initialize

        
On this page

Search results