ErrorController

This controller provides actions for common HTTP error scenarios (404, 403, 500, 503) and supports custom error handling through site-specific error handlers. If no custom error handler is configured, it falls back to rendering a standard TYPO3 error page with appropriate status code and message.

Attributes
#[Autoconfigure]
$public: true

Table of Contents

Methods

__construct()  : mixed
accessDeniedAction()  : ResponseInterface
Used for creating a 403 response ("Access denied"), but if configured, a RedirectResponse could be returned as well.
customErrorAction()  : ResponseInterface
Used for creating an error with a custom status code, but if configured, a RedirectResponse could be returned as well.
internalErrorAction()  : ResponseInterface
Used for creating a 500 response ("Internal Server Error"), usually due to some misconfiguration.
pageNotFoundAction()  : ResponseInterface
Used for creating a 404 response ("Page Not Found"), but if configured, a RedirectResponse could be returned as well.
unavailableAction()  : ResponseInterface
Used for creating a 503 response ("Service Unavailable"), to be used for maintenance mode or when the server is overloaded, a RedirectResponse could be returned as well.
getErrorHandlerFromSite()  : PageErrorHandlerInterface|null
Checks if a site is configured, and an error handler is configured for this specific status code.
handleError()  : ResponseInterface
Handles the error by creating a response object. Acts as a fallback when no error handler is configured.
isRequestFromDevIp()  : bool
Checks whether the devIPMask matches the current visitor's IP address.

Methods

accessDeniedAction()

Used for creating a 403 response ("Access denied"), but if configured, a RedirectResponse could be returned as well.

public accessDeniedAction(ServerRequestInterface $request, string $message[, array<string|int, mixed> $reasons = [] ]) : ResponseInterface
Parameters
$request : ServerRequestInterface
$message : string
$reasons : array<string|int, mixed> = []
Tags
throws
PageNotFoundException
Return values
ResponseInterface

customErrorAction()

Used for creating an error with a custom status code, but if configured, a RedirectResponse could be returned as well.

public customErrorAction(ServerRequestInterface $request, int $statusCode, string $title, string $message[, string $technicalReason = '' ][, array<string, mixed> $reasons = [] ][, int $errorCode = 0 ]) : ResponseInterface
Parameters
$request : ServerRequestInterface
$statusCode : int
$title : string
$message : string
$technicalReason : string = ''
$reasons : array<string, mixed> = []

An array of reasons for evaluation in a possible resolved the error handler

$errorCode : int = 0
Tags
throws
PageNotFoundException
Return values
ResponseInterface

internalErrorAction()

Used for creating a 500 response ("Internal Server Error"), usually due to some misconfiguration.

public internalErrorAction(ServerRequestInterface $request, string $message[, array<string|int, mixed> $reasons = [] ]) : ResponseInterface

If a page unavailable handler is configured, a RedirectResponse could be returned as well.

Parameters
$request : ServerRequestInterface
$message : string
$reasons : array<string|int, mixed> = []
Tags
throws
InternalServerErrorException
Return values
ResponseInterface

pageNotFoundAction()

Used for creating a 404 response ("Page Not Found"), but if configured, a RedirectResponse could be returned as well.

public pageNotFoundAction(ServerRequestInterface $request, string $message[, array<string|int, mixed> $reasons = [] ]) : ResponseInterface
Parameters
$request : ServerRequestInterface
$message : string
$reasons : array<string|int, mixed> = []
Tags
throws
PageNotFoundException
Return values
ResponseInterface

unavailableAction()

Used for creating a 503 response ("Service Unavailable"), to be used for maintenance mode or when the server is overloaded, a RedirectResponse could be returned as well.

public unavailableAction(ServerRequestInterface $request, string $message[, array<string|int, mixed> $reasons = [] ]) : ResponseInterface
Parameters
$request : ServerRequestInterface
$message : string
$reasons : array<string|int, mixed> = []
Tags
throws
ServiceUnavailableException
Return values
ResponseInterface

getErrorHandlerFromSite()

Checks if a site is configured, and an error handler is configured for this specific status code.

protected getErrorHandlerFromSite(ServerRequestInterface $request, int $statusCode) : PageErrorHandlerInterface|null
Parameters
$request : ServerRequestInterface
$statusCode : int
Return values
PageErrorHandlerInterface|null

handleError()

Handles the error by creating a response object. Acts as a fallback when no error handler is configured.

protected handleError(ServerRequestInterface $request, int $statusCode, string $title, string $message[, string $technicalReason = '' ][, int $errorCode = 0 ]) : ResponseInterface
Parameters
$request : ServerRequestInterface
$statusCode : int
$title : string
$message : string
$technicalReason : string = ''
$errorCode : int = 0
Return values
ResponseInterface

isRequestFromDevIp()

Checks whether the devIPMask matches the current visitor's IP address.

protected isRequestFromDevIp(ServerRequestInterface $request) : bool
Parameters
$request : ServerRequestInterface
Return values
bool

False if the server error handler should be used.


        
On this page

Search results