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 some misconfiguration but if configured, a RedirectResponse could be returned as well.
- 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
Return values
ResponseInterfaceinternalErrorAction()
Used for creating a 500 response ("Internal Server Error"), usually due some misconfiguration but if configured, a RedirectResponse could be returned as well.
public
internalErrorAction(ServerRequestInterface $request, string $message[, array<string|int, mixed> $reasons = [] ]) : ResponseInterface
Parameters
- $request : ServerRequestInterface
- $message : string
- $reasons : array<string|int, mixed> = []
Tags
Return values
ResponseInterfacepageNotFoundAction()
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
Return values
ResponseInterfaceunavailableAction()
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
Return values
ResponseInterfacegetErrorHandlerFromSite()
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|nullhandleDefaultError()
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
ResponseInterfaceisPageUnavailableHandlerConfigured()
Checks whether the devIPMask matches the current visitor's IP address.
protected
isPageUnavailableHandlerConfigured() : bool
Note: the name of this method is a misnomer (legacy code),
Return values
bool —True if the server error handler should be used.