ErrorController

Handles error requests, returns a response object.

Table of Contents

Methods

accessDeniedAction()  : ResponseInterface
Used for creating a 403 response ("Access denied"), 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.
handleDefaultError()  : ResponseInterface
Ensures that a response object is created as a "fallback" when no error handler is configured.
isPageUnavailableHandlerConfigured()  : 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

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

handleDefaultError()

Ensures that a response object is created as a "fallback" when no error handler is configured.

protected handleDefaultError(ServerRequestInterface $request, int $statusCode[, string $reason = '' ]) : ResponseInterface
Parameters
$request : ServerRequestInterface
$statusCode : int
$reason : string = ''
Return values
ResponseInterface

isPageUnavailableHandlerConfigured()

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

protected isPageUnavailableHandlerConfigured(ServerRequestInterface $request) : bool

Note: the name of this method is a misnomer (legacy code),

Parameters
$request : ServerRequestInterface
Return values
bool

True if the server error handler should be used.


        
On this page

Search results