‪TYPO3CMS  10.4
TYPO3\CMS\Core\Error\ErrorHandler Class Reference
Inheritance diagram for TYPO3\CMS\Core\Error\ErrorHandler:
TYPO3\CMS\Core\Error\ErrorHandlerInterface

Public Member Functions

 __construct ($errorHandlerErrors)
 
 setExceptionalErrors ($exceptionalErrors)
 
 setDebugMode ($debugMode)
 
 registerErrorHandler ()
 
bool handleError ($errorLevel, $errorMessage, $errorFile, $errorLine)
 

Protected Member Functions

 writeLog ($logMessage, $severity)
 
TimeTracker getTimeTracker ()
 
TYPO3 CMS Core Authentication BackendUserAuthentication getBackendUser ()
 

Protected Attributes

int $exceptionalErrors = 0
 
int $errorHandlerErrors = 0
 
bool $debugMode = false
 

Detailed Description

Global error handler for TYPO3

This file is a backport from TYPO3 Flow

Definition at line 36 of file ErrorHandler.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Error\ErrorHandler::__construct (   $errorHandlerErrors)

Registers this class as default error handler

Parameters
int$errorHandlerErrors‪The integer representing the E_* error level which should be

Implements TYPO3\CMS\Core\Error\ErrorHandlerInterface.

Definition at line 63 of file ErrorHandler.php.

References TYPO3\CMS\Core\Error\ErrorHandler\$errorHandlerErrors.

Member Function Documentation

◆ getBackendUser()

TYPO3 CMS Core Authentication BackendUserAuthentication TYPO3\CMS\Core\Error\ErrorHandler::getBackendUser ( )
protected
Returns
‪\TYPO3\CMS\Core\Authentication\BackendUserAuthentication

Definition at line 253 of file ErrorHandler.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Core\Error\ErrorHandler\writeLog().

◆ getTimeTracker()

TimeTracker TYPO3\CMS\Core\Error\ErrorHandler::getTimeTracker ( )
protected
Returns
TimeTracker

Definition at line 245 of file ErrorHandler.php.

Referenced by TYPO3\CMS\Core\Error\ErrorHandler\handleError().

◆ handleError()

bool TYPO3\CMS\Core\Error\ErrorHandler::handleError (   $errorLevel,
  $errorMessage,
  $errorFile,
  $errorLine 
)

Handles an error. If the error is registered as exceptionalError it will by converted into an exception, to be handled by the configured exceptionhandler. Additionally the error message is written to the configured logs. If TYPO3_MODE is 'BE' the error message is also added to the flashMessageQueue, in FE the error message is displayed in the admin panel (as TsLog message)

Parameters
int$errorLevel‪The error level - one of the E_* constants
string$errorMessage‪The error message
string$errorFile‪Name of the file the error occurred in
int$errorLine‪Line number where the error occurred
Returns
‪bool
Exceptions
Exception‪with the data passed to this method if the error is registered as exceptionalError

Implements TYPO3\CMS\Core\Error\ErrorHandlerInterface.

Definition at line 110 of file ErrorHandler.php.

References $GLOBALS, TYPO3\CMS\Core\Error\ErrorHandler\getTimeTracker(), TYPO3\CMS\Core\Log\LogLevel\normalizeLevel(), TYPO3\CMS\Core\Messaging\AbstractMessage\NOTICE, TYPO3\CMS\Core\Messaging\AbstractMessage\OK, TYPO3\CMS\Core\TimeTracker\TimeTracker\setTSlogMessage(), TYPO3\CMS\Core\Messaging\AbstractMessage\WARNING, and TYPO3\CMS\Core\Error\ErrorHandler\writeLog().

◆ registerErrorHandler()

TYPO3\CMS\Core\Error\ErrorHandler::registerErrorHandler ( )

Definition at line 91 of file ErrorHandler.php.

◆ setDebugMode()

TYPO3\CMS\Core\Error\ErrorHandler::setDebugMode (   $debugMode)
Parameters
bool$debugMode

Definition at line 86 of file ErrorHandler.php.

References TYPO3\CMS\Core\Error\ErrorHandler\$debugMode.

◆ setExceptionalErrors()

TYPO3\CMS\Core\Error\ErrorHandler::setExceptionalErrors (   $exceptionalErrors)

Defines which error levels should result in an exception thrown.

Parameters
int$exceptionalErrors‪The integer representing the E_* error level to handle as exceptions

Implements TYPO3\CMS\Core\Error\ErrorHandlerInterface.

Definition at line 75 of file ErrorHandler.php.

References TYPO3\CMS\Core\Error\ErrorHandler\$exceptionalErrors.

◆ writeLog()

TYPO3\CMS\Core\Error\ErrorHandler::writeLog (   $logMessage,
  $severity 
)
protected

Writes an error in the sys_log table

Parameters
string$logMessage‪Default text that follows the message (in english!).
int$severity‪The error level of the message (0 = OK, 1 = warning, 2 = error)

Definition at line 202 of file ErrorHandler.php.

References $GLOBALS, and TYPO3\CMS\Core\Error\ErrorHandler\getBackendUser().

Referenced by TYPO3\CMS\Core\Error\ErrorHandler\handleError().

Member Data Documentation

◆ $debugMode

bool TYPO3\CMS\Core\Error\ErrorHandler::$debugMode = false
protected

Whether to write a flash message in case of an error

Definition at line 56 of file ErrorHandler.php.

Referenced by TYPO3\CMS\Core\Error\ErrorHandler\setDebugMode().

◆ $errorHandlerErrors

int TYPO3\CMS\Core\Error\ErrorHandler::$errorHandlerErrors = 0
protected

Error levels which should be handled.

Definition at line 50 of file ErrorHandler.php.

Referenced by TYPO3\CMS\Core\Error\ErrorHandler\__construct().

◆ $exceptionalErrors

int TYPO3\CMS\Core\Error\ErrorHandler::$exceptionalErrors = 0
protected

Error levels which should result in an exception thrown.

Definition at line 44 of file ErrorHandler.php.

Referenced by TYPO3\CMS\Core\Error\ErrorHandler\setExceptionalErrors().