ProductionExceptionHandler extends AbstractExceptionHandler
An exception handler which catches any exception and renders an error page without backtrace (Web) or a slim message on CLI.
Table of Contents
Constants
- CONTEXT_CLI = 'CLI'
- CONTEXT_WEB = 'WEB'
- IGNORED_HMAC_EXCEPTION_CODES = [ 1581862822, // Failed HMAC validation due to modified __trustedProperties in extbase property mapping 1581862823, // Failed HMAC validation due to modified form state in ext:forms 1320830018, // Failed HMAC validation due to modified HMAC string in Extbase HashService 1320830276, // Failed HMAC validation due to too short HMAC string in Extbase HashService 1704454157, // Failed HMAC validation due to modified HMAC string in Core HashService 1704454152, ]
- IGNORED_EXCEPTION_CODES = [ 1396795884, // Current host header value does not match the configured trusted hosts pattern 1616175867, // Backend login request is rate limited 1616175847, // Frontend login request is rate limited 1436717275, // Request with unsupported HTTP method 1699604555, // Outdated __trustedProperties format in extbase property mapping 1517949792, // The IP address of your client does not match the list of allowed IP addresses 1517949793, // Backend access by browser is locked for maintenance 1517949794, ]
Properties
- $defaultMessage : string
- Default message for error messages
- $defaultTitle : string
- Default title for error messages
- $logExceptionStackTrace : bool
Methods
- __construct() : mixed
- Constructs this exception handler - registers itself as the default exception handler.
- echoExceptionCLI() : mixed
- Echoes an exception for the command line.
- echoExceptionWeb() : mixed
- Echoes an exception for the web.
- handleException() : mixed
- Displays the given exception
- anonymizeToken() : string
- Replaces the generated token with a generic equivalent
- discloseExceptionInformation() : bool
- Determines, whether Exception details should be outputted
- getBackendUser() : BackendUserAuthentication|null
- getMessage() : string
- Returns the message for the error message
- getTitle() : string
- Returns the title for the error message
- sendStatusHeaders() : mixed
- Sends the HTTP Status 500 code, if $exception is *not* a TYPO3\CMS\Core\Error\Http\StatusException and headers are not sent, yet.
- writeLog() : mixed
- Writes an exception in the sys_log table
- writeLogEntries() : void
- Writes exception to different logs
Constants
CONTEXT_CLI
public
mixed
CONTEXT_CLI
= 'CLI'
CONTEXT_WEB
public
mixed
CONTEXT_WEB
= 'WEB'
IGNORED_HMAC_EXCEPTION_CODES
public
mixed
IGNORED_HMAC_EXCEPTION_CODES
= [
1581862822,
// Failed HMAC validation due to modified __trustedProperties in extbase property mapping
1581862823,
// Failed HMAC validation due to modified form state in ext:forms
1320830018,
// Failed HMAC validation due to modified HMAC string in Extbase HashService
1320830276,
// Failed HMAC validation due to too short HMAC string in Extbase HashService
1704454157,
// Failed HMAC validation due to modified HMAC string in Core HashService
1704454152,
]
IGNORED_EXCEPTION_CODES
protected
mixed
IGNORED_EXCEPTION_CODES
= [
1396795884,
// Current host header value does not match the configured trusted hosts pattern
1616175867,
// Backend login request is rate limited
1616175847,
// Frontend login request is rate limited
1436717275,
// Request with unsupported HTTP method
1699604555,
// Outdated __trustedProperties format in extbase property mapping
1517949792,
// The IP address of your client does not match the list of allowed IP addresses
1517949793,
// Backend access by browser is locked for maintenance
1517949794,
]
Properties
$defaultMessage
Default message for error messages
protected
string
$defaultMessage
= ''
$defaultTitle
Default title for error messages
protected
string
$defaultTitle
= 'Oops, an error occurred!'
$logExceptionStackTrace
protected
bool
$logExceptionStackTrace
= false
Methods
__construct()
Constructs this exception handler - registers itself as the default exception handler.
public
__construct() : mixed
echoExceptionCLI()
Echoes an exception for the command line.
public
echoExceptionCLI(Throwable $exception) : mixed
Parameters
- $exception : Throwable
-
The throwable object.
echoExceptionWeb()
Echoes an exception for the web.
public
echoExceptionWeb(Throwable $exception) : mixed
Parameters
- $exception : Throwable
-
The throwable object.
handleException()
Displays the given exception
public
handleException(Throwable $exception) : mixed
Parameters
- $exception : Throwable
-
The throwable object.
Tags
anonymizeToken()
Replaces the generated token with a generic equivalent
protected
anonymizeToken(string $requestedUrl) : string
Parameters
- $requestedUrl : string
Return values
stringdiscloseExceptionInformation()
Determines, whether Exception details should be outputted
protected
discloseExceptionInformation(Throwable $exception) : bool
Parameters
- $exception : Throwable
-
The throwable object.
Return values
boolgetBackendUser()
protected
getBackendUser() : BackendUserAuthentication|null
Return values
BackendUserAuthentication|nullgetMessage()
Returns the message for the error message
protected
getMessage(Throwable $exception) : string
Parameters
- $exception : Throwable
-
The throwable object.
Return values
stringgetTitle()
Returns the title for the error message
protected
getTitle(Throwable $exception) : string
Parameters
- $exception : Throwable
-
The throwable object.
Return values
stringsendStatusHeaders()
Sends the HTTP Status 500 code, if $exception is *not* a TYPO3\CMS\Core\Error\Http\StatusException and headers are not sent, yet.
protected
sendStatusHeaders(Throwable $exception) : mixed
Parameters
- $exception : Throwable
-
The throwable object.
writeLog()
Writes an exception in the sys_log table
protected
writeLog(string $logMessage) : mixed
Parameters
- $logMessage : string
-
Default text that follows the message.
writeLogEntries()
Writes exception to different logs
protected
writeLogEntries(Throwable $exception, string $mode) : void
Parameters
- $exception : Throwable
-
The throwable object.
- $mode : string
-
The context where the exception was thrown. Either self::CONTEXT_WEB or self::CONTEXT_CLI.