class Handler implements ExceptionHandler (View source)

Properties

protected Container $container

The container implementation.

protected array $dontReport

A list of the exception types that are not reported.

protected array $internalDontReport

A list of the internal exception types that should not be reported.

protected array $dontFlash

A list of the inputs that are never flashed for validation exceptions.

Methods

void
__construct(Container $container)

Create a new exception handler instance.

void
report(Exception $e)

Report or log an exception.

bool
shouldReport(Exception $e)

Determine if the exception should be reported.

bool
shouldntReport(Exception $e)

Determine if the exception is in the "do not report" list.

array
exceptionContext(Exception $e)

Get the default exception context variables for logging.

array
context()

Get the default context variables for logging.

Response
render(Request $request, Exception $e)

Render an exception into an HTTP response.

prepareException(Exception $e)

Prepare exception for rendering.

Response
unauthenticated(Request $request, AuthenticationException $exception)

Convert an authentication exception into a response.

Response
convertValidationExceptionToResponse(ValidationException $e, Request $request)

Create a response object from the given validation exception.

invalid(Request $request, ValidationException $exception)

Convert a validation exception into a response.

invalidJson(Request $request, ValidationException $exception)

Convert a validation exception into a JSON response.

Response
prepareResponse(Request $request, Exception $e)

Prepare a response for the given exception.

Response
convertExceptionToResponse(Exception $e)

Create a Symfony response for the given exception.

string
renderExceptionContent(Exception $e)

Get the response content for the given exception.

string
renderExceptionWithWhoops(Exception $e)

Render an exception to a string using "Whoops".

Handler
whoopsHandler()

Get the Whoops handler for the application.

string
renderExceptionWithSymfony(Exception $e, bool $debug)

Render an exception to a string using Symfony.

Response
renderHttpException(HttpExceptionInterface $e)

Render the given HttpException.

void
registerErrorViewPaths()

Register the error template hint paths.

string
getHttpExceptionView(HttpExceptionInterface $e)

Get the view used to render HTTP exceptions.

toIlluminateResponse(Response $response, Exception $e)

Map the given exception into an Illuminate response.

prepareJsonResponse(Request $request, Exception $e)

Prepare a JSON response for the given exception.

array
convertExceptionToArray(Exception $e)

Convert the given exception to an array.

void
renderForConsole(OutputInterface $output, Exception $e)

Render an exception to the console.

bool
isHttpException(Exception $e)

Determine if the given exception is an HTTP exception.

Details

void __construct(Container $container)

Create a new exception handler instance.

Parameters

Container $container

Return Value

void

void report(Exception $e)

Report or log an exception.

Parameters

Exception $e

Return Value

void

Exceptions

Exception

bool shouldReport(Exception $e)

Determine if the exception should be reported.

Parameters

Exception $e

Return Value

bool

protected bool shouldntReport(Exception $e)

Determine if the exception is in the "do not report" list.

Parameters

Exception $e

Return Value

bool

protected array exceptionContext(Exception $e)

Get the default exception context variables for logging.

Parameters

Exception $e

Return Value

array

protected array context()

Get the default context variables for logging.

Return Value

array

Response render(Request $request, Exception $e)

Render an exception into an HTTP response.

Parameters

Request $request
Exception $e

Return Value

Response

Exceptions

Exception

protected Exception prepareException(Exception $e)

Prepare exception for rendering.

Parameters

Exception $e

Return Value

Exception

protected Response unauthenticated(Request $request, AuthenticationException $exception)

Convert an authentication exception into a response.

Parameters

Request $request
AuthenticationException $exception

Return Value

Response

protected Response convertValidationExceptionToResponse(ValidationException $e, Request $request)

Create a response object from the given validation exception.

Parameters

ValidationException $e
Request $request

Return Value

Response

protected Response invalid(Request $request, ValidationException $exception)

Convert a validation exception into a response.

Parameters

Request $request
ValidationException $exception

Return Value

Response

protected JsonResponse invalidJson(Request $request, ValidationException $exception)

Convert a validation exception into a JSON response.

Parameters

Request $request
ValidationException $exception

Return Value

JsonResponse

protected Response prepareResponse(Request $request, Exception $e)

Prepare a response for the given exception.

Parameters

Request $request
Exception $e

Return Value

Response

protected Response convertExceptionToResponse(Exception $e)

Create a Symfony response for the given exception.

Parameters

Exception $e

Return Value

Response

protected string renderExceptionContent(Exception $e)

Get the response content for the given exception.

Parameters

Exception $e

Return Value

string

protected string renderExceptionWithWhoops(Exception $e)

Render an exception to a string using "Whoops".

Parameters

Exception $e

Return Value

string

protected Handler whoopsHandler()

Get the Whoops handler for the application.

Return Value

Handler

protected string renderExceptionWithSymfony(Exception $e, bool $debug)

Render an exception to a string using Symfony.

Parameters

Exception $e
bool $debug

Return Value

string

protected Response renderHttpException(HttpExceptionInterface $e)

Render the given HttpException.

Parameters

HttpExceptionInterface $e

Return Value

Response

protected void registerErrorViewPaths()

Register the error template hint paths.

Return Value

void

protected string getHttpExceptionView(HttpExceptionInterface $e)

Get the view used to render HTTP exceptions.

Parameters

HttpExceptionInterface $e

Return Value

string

protected Response toIlluminateResponse(Response $response, Exception $e)

Map the given exception into an Illuminate response.

Parameters

Response $response
Exception $e

Return Value

Response

protected JsonResponse prepareJsonResponse(Request $request, Exception $e)

Prepare a JSON response for the given exception.

Parameters

Request $request
Exception $e

Return Value

JsonResponse

protected array convertExceptionToArray(Exception $e)

Convert the given exception to an array.

Parameters

Exception $e

Return Value

array

void renderForConsole(OutputInterface $output, Exception $e)

Render an exception to the console.

Parameters

OutputInterface $output
Exception $e

Return Value

void

protected bool isHttpException(Exception $e)

Determine if the given exception is an HTTP exception.

Parameters

Exception $e

Return Value

bool