DefaultErrorHandler
in package
FinalYes
Default Error Renderer.
Table of Contents
Properties
- $logger : mixed
- $responder : Responder
- $responseFactory : ResponseFactoryInterface
Methods
- __construct() : mixed
- The constructor.
- __invoke() : ResponseInterface
- Invoke.
- getErrorMessage() : string
- Get error message.
- getExceptionText() : string
- Get exception text.
- getHttpStatusCode() : int
- Get http status code.
Properties
$logger
protected
mixed
$logger
$responder
private
Responder
$responder
$responseFactory
private
ResponseFactoryInterface
$responseFactory
Methods
__construct()
The constructor.
public
__construct(Responder $responder, ResponseFactoryInterface $responseFactory) : mixed
Parameters
- $responder : Responder
-
The responder
- $responseFactory : ResponseFactoryInterface
-
The response factory
__invoke()
Invoke.
public
__invoke(ServerRequestInterface $request, Throwable $exception, bool $displayErrorDetails, bool $logErrors) : ResponseInterface
Parameters
- $request : ServerRequestInterface
-
The request
- $exception : Throwable
-
The exception
- $displayErrorDetails : bool
-
Show error details
- $logErrors : bool
-
Log errors
Return values
ResponseInterface —The response
getErrorMessage()
Get error message.
private
getErrorMessage(Throwable $exception, int $statusCode, bool $displayErrorDetails) : string
Parameters
- $exception : Throwable
-
The error
- $statusCode : int
-
The http status code
- $displayErrorDetails : bool
-
Display details
Return values
string —The message
getExceptionText()
Get exception text.
private
getExceptionText(Throwable $exception[, int $maxLength = 0 ]) : string
Parameters
- $exception : Throwable
-
Error
- $maxLength : int = 0
-
The max length of the error message
Return values
string —The full error message
getHttpStatusCode()
Get http status code.
private
getHttpStatusCode(Throwable $exception) : int
Parameters
- $exception : Throwable
-
The exception
Return values
int —The http code