Handler
extends Handler
in package
Table of Contents
- $container : Container
- The container implementation.
- $dontFlash : array<string|int, mixed>
- A list of the inputs that are never flashed for validation exceptions.
- $dontReport : array<string|int, mixed>
- A list of the exception types that should not be reported.
- $handlers : array<string|int, mixed>
- All of the register exception handlers.
- $internalDontReport : array<string|int, mixed>
- A list of the internal exception types that should not be reported.
- __construct() : void
- Create a new exception handler instance.
- error() : void
- Register an application error handler.
- render() : Response
- Render an exception into an HTTP response.
- renderForConsole() : void
- Render an exception to the console.
- report() : void
- Report or log an exception.
- shouldReport() : bool
- Determine if the exception should be reported.
- callCustomHandlers() : void
- Handle the given exception.
- context() : array<string|int, mixed>
- Get the default context variables for logging.
- convertExceptionToArray() : array<string|int, mixed>
- Convert the given exception to an array.
- convertExceptionToResponse() : Response
- Create a Symfony response for the given exception.
- convertValidationExceptionToResponse() : Response
- Create a response object from the given validation exception.
- getStatusCode() : int
- Checks if the exception implements the HttpExceptionInterface, or returns as generic 500 error code for a server side error.
- handlesException() : bool
- Determine if the given handler handles this exception.
- hints() : bool
- Determine if the given handler type hints the exception.
- invalid() : Response
- Convert a validation exception into a response.
- invalidJson() : JsonResponse
- Convert a validation exception into a JSON response.
- isHttpException() : bool
- Determine if the given exception is an HTTP exception.
- prepareException() : Exception
- Prepare exception for rendering.
- prepareJsonResponse() : JsonResponse
- Prepare a JSON response for the given exception.
- prepareResponse() : Response
- Prepare a response for the given exception.
- renderExceptionWithSymfony() : string
- Render an exception to a string using Symfony.
- renderExceptionWithWhoops() : string
- Render an exception to a string using "Whoops".
- renderHttpException() : Response
- Render the given HttpException.
- shouldntReport() : bool
- Determine if the exception is in the "do not report" list.
- toIlluminateResponse() : Response
- Map the given exception into an Illuminate response.
- unauthenticated() : Response
- Convert an authentication exception into a response.
- whoopsHandler() : Handler
- Get the Whoops handler for the application.
Properties
$container
The container implementation.
protected
Container
$container
$dontFlash
A list of the inputs that are never flashed for validation exceptions.
protected
array<string|int, mixed>
$dontFlash
= ['password', 'password_confirmation']
$dontReport
A list of the exception types that should not be reported.
protected
array<string|int, mixed>
$dontReport
= [OctoberRainExceptionAjaxException::class, OctoberRainExceptionValidationException::class, OctoberRainExceptionApplicationException::class, IlluminateDatabaseEloquentModelNotFoundException::class, SymfonyComponentHttpKernelExceptionHttpException::class]
$handlers
All of the register exception handlers.
protected
array<string|int, mixed>
$handlers
= []
$internalDontReport
A list of the internal exception types that should not be reported.
protected
array<string|int, mixed>
$internalDontReport
= [IlluminateAuthAuthenticationException::class, IlluminateAuthAccessAuthorizationException::class, SymfonyComponentHttpKernelExceptionHttpException::class, IlluminateHttpExceptionsHttpResponseException::class, IlluminateDatabaseEloquentModelNotFoundException::class, IlluminateSessionTokenMismatchException::class, IlluminateValidationValidationException::class]
Methods
__construct()
Create a new exception handler instance.
public
__construct(Container $container) : void
Parameters
- $container : Container
Return values
void —error()
Register an application error handler.
public
error(Closure $callback) : void
Parameters
- $callback : Closure
Return values
void —render()
Render an exception into an HTTP response.
public
render(Request $request, Exception $exception) : Response
Parameters
- $request : Request
- $exception : Exception
Return values
Response —renderForConsole()
Render an exception to the console.
public
renderForConsole(OutputInterface $output, Exception $e) : void
Parameters
- $output : OutputInterface
- $e : Exception
Return values
void —report()
Report or log an exception.
public
report(Exception $exception) : void
This is a great spot to send exceptions to Sentry, Bugsnag, etc.
Parameters
- $exception : Exception
Return values
void —shouldReport()
Determine if the exception should be reported.
public
shouldReport(Exception $e) : bool
Parameters
- $e : Exception
Return values
bool —callCustomHandlers()
Handle the given exception.
protected
callCustomHandlers(Exception $exception[, bool $fromConsole = false ]) : void
Parameters
- $exception : Exception
- $fromConsole : bool = false
Return values
void —context()
Get the default context variables for logging.
protected
context() : array<string|int, mixed>
Return values
array<string|int, mixed> —convertExceptionToArray()
Convert the given exception to an array.
protected
convertExceptionToArray(Exception $e) : array<string|int, mixed>
Parameters
- $e : Exception
Return values
array<string|int, mixed> —convertExceptionToResponse()
Create a Symfony response for the given exception.
protected
convertExceptionToResponse(Exception $e) : Response
Parameters
- $e : Exception
Return values
Response —convertValidationExceptionToResponse()
Create a response object from the given validation exception.
protected
convertValidationExceptionToResponse(ValidationException $e, Request $request) : Response
Parameters
- $e : ValidationException
- $request : Request
Return values
Response —getStatusCode()
Checks if the exception implements the HttpExceptionInterface, or returns as generic 500 error code for a server side error.
protected
getStatusCode(Exception $exception) : int
Parameters
- $exception : Exception
Return values
int —handlesException()
Determine if the given handler handles this exception.
protected
handlesException(Closure $handler, Exception $exception) : bool
Parameters
- $handler : Closure
- $exception : Exception
Return values
bool —hints()
Determine if the given handler type hints the exception.
protected
hints(ReflectionFunction $reflection, Exception $exception) : bool
Parameters
- $reflection : ReflectionFunction
- $exception : Exception
Return values
bool —invalid()
Convert a validation exception into a response.
protected
invalid(Request $request, ValidationException $exception) : Response
Parameters
- $request : Request
- $exception : ValidationException
Return values
Response —invalidJson()
Convert a validation exception into a JSON response.
protected
invalidJson(Request $request, ValidationException $exception) : JsonResponse
Parameters
- $request : Request
- $exception : ValidationException
Return values
JsonResponse —isHttpException()
Determine if the given exception is an HTTP exception.
protected
isHttpException(Exception $e) : bool
Parameters
- $e : Exception
Return values
bool —prepareException()
Prepare exception for rendering.
protected
prepareException(Exception $e) : Exception
Parameters
- $e : Exception
Return values
Exception —prepareJsonResponse()
Prepare a JSON response for the given exception.
protected
prepareJsonResponse(Request $request, Exception $e) : JsonResponse
Parameters
- $request : Request
- $e : Exception
Return values
JsonResponse —prepareResponse()
Prepare a response for the given exception.
protected
prepareResponse(Request $request, Exception $e) : Response
Parameters
- $request : Request
- $e : Exception
Return values
Response —renderExceptionWithSymfony()
Render an exception to a string using Symfony.
protected
renderExceptionWithSymfony(Exception $e, bool $debug) : string
Parameters
- $e : Exception
- $debug : bool
Return values
string —renderExceptionWithWhoops()
Render an exception to a string using "Whoops".
protected
renderExceptionWithWhoops(Exception $e) : string
Parameters
- $e : Exception
Return values
string —renderHttpException()
Render the given HttpException.
protected
renderHttpException(HttpException $e) : Response
Parameters
- $e : HttpException
Return values
Response —shouldntReport()
Determine if the exception is in the "do not report" list.
protected
shouldntReport(Exception $e) : bool
Parameters
- $e : Exception
Return values
bool —toIlluminateResponse()
Map the given exception into an Illuminate response.
protected
toIlluminateResponse(Response $response, Exception $e) : Response
Parameters
- $response : Response
- $e : Exception
Return values
Response —unauthenticated()
Convert an authentication exception into a response.
protected
unauthenticated(Request $request, AuthenticationException $exception) : Response
Parameters
- $request : Request
- $exception : AuthenticationException
Return values
Response —whoopsHandler()
Get the Whoops handler for the application.
protected
whoopsHandler() : Handler