On this page
Handler
class Handler implements ExceptionHandler (View source)
Traits
Properties
protected Container | $container | The container implementation. |
|
protected Throwable>> | $dontReport | A list of the exception types that are not reported. |
|
protected ReportableHandler[] | $reportCallbacks | The callbacks that should be used during reporting. |
|
protected | $levels | A map of exceptions with their corresponding custom log levels. |
|
protected Closure[] | $renderCallbacks | The callbacks that should be used during rendering. |
|
protected Closure> | $exceptionMap | The registered exception mappings. |
|
protected Throwable>> | $internalDontReport | A list of the internal exception types that should not be reported. |
|
protected array<int,string> | $dontFlash | A list of the inputs that are never flashed for validation exceptions. |
Methods
string | firstClosureParameterType(Closure $closure) Get the class name of the first parameter of the given Closure. |
from ReflectsClosures |
array | firstClosureParameterTypes(Closure $closure) Get the class names of the first parameter of the given Closure, including union types. |
from ReflectsClosures |
array | closureParameterTypes(Closure $closure) Get the class names / types of the parameters of the given Closure. |
from ReflectsClosures |
void | __construct(Container $container) Create a new exception handler instance. |
|
void | register() Register the exception handling callbacks for the application. |
|
ReportableHandler | reportable(callable $reportUsing) Register a reportable callback. |
|
$this | renderable(callable $renderUsing) Register a renderable callback. |
|
$this | map(Closure|string $from, Closure|string|null $to = null) Register a new exception mapping. |
|
$this | ignore(string $class) Indicate that the given exception type should not be reported. |
|
$this | level(Throwable> $type, $level) Set the log level for the given exception type. |
|
void | report(Throwable $e) Report or log an exception. |
|
bool | shouldReport(Throwable $e) Determine if the exception should be reported. |
|
bool | shouldntReport(Throwable $e) Determine if the exception is in the "do not report" list. |
|
$this | stopIgnoring(string $exception) Remove the given exception class from the list of exceptions that should be ignored. |
|
array | buildExceptionContext(Throwable $e) Create the context array for logging the given exception. |
|
array | exceptionContext(Throwable $e) Get the default exception context variables for logging. |
|
array | context() Get the default context variables for logging. |
|
Response | render(Request $request, Throwable $e) Render an exception into an HTTP response. |
|
Throwable | prepareException(Throwable $e) Prepare exception for rendering. |
|
Throwable | mapException(Throwable $e) Map the exception using a registered mapper if possible. |
|
mixed | renderViaCallbacks(Request $request, Throwable $e) Try to render a response from request and exception via render callbacks. |
|
Response|RedirectResponse | renderExceptionResponse(Request $request, Throwable $e) Render a default exception response if any. |
|
Response|RedirectResponse | 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. |
|
Response|RedirectResponse | invalid(Request $request, ValidationException $exception) Convert a validation exception into a response. |
|
JsonResponse | invalidJson(Request $request, ValidationException $exception) Convert a validation exception into a JSON response. |
|
bool | shouldReturnJson(Request $request, Throwable $e) Determine if the exception handler response should be JSON. |
|
Response|RedirectResponse | prepareResponse(Request $request, Throwable $e) Prepare a response for the given exception. |
|
Response | convertExceptionToResponse(Throwable $e) Create a Symfony response for the given exception. |
|
string | renderExceptionContent(Throwable $e) Get the response content for the given exception. |
|
string | renderExceptionWithCustomRenderer(Throwable $e) Render an exception to a string using the registered |
|
string | renderExceptionWithSymfony(Throwable $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|null | getHttpExceptionView(HttpExceptionInterface $e) Get the view used to render HTTP exceptions. |
|
Response|RedirectResponse | toIlluminateResponse(Response $response, Throwable $e) Map the given exception into an Illuminate response. |
|
JsonResponse | prepareJsonResponse(Request $request, Throwable $e) Prepare a JSON response for the given exception. |
|
array | convertExceptionToArray(Throwable $e) Convert the given exception to an array. |
|
void | renderForConsole(OutputInterface $output, Throwable $e) Render an exception to the console. |
|
bool | isHttpException(Throwable $e) Determine if the given exception is an HTTP exception. |
Details
protected string firstClosureParameterType(Closure $closure)
Get the class name of the first parameter of the given Closure.
protected array firstClosureParameterTypes(Closure $closure)
Get the class names of the first parameter of the given Closure, including union types.
protected array closureParameterTypes(Closure $closure)
Get the class names / types of the parameters of the given Closure.
void __construct(Container $container)
Create a new exception handler instance.
void register()
Register the exception handling callbacks for the application.
ReportableHandler reportable(callable $reportUsing)
Register a reportable callback.
$this renderable(callable $renderUsing)
Register a renderable callback.
$this ignore(string $class)
Indicate that the given exception type should not be reported.
$this level(Throwable> $type, $level)
Set the log level for the given exception type.
void report(Throwable $e)
Report or log an exception.
bool shouldReport(Throwable $e)
Determine if the exception should be reported.
protected bool shouldntReport(Throwable $e)
Determine if the exception is in the "do not report" list.
$this stopIgnoring(string $exception)
Remove the given exception class from the list of exceptions that should be ignored.
protected array buildExceptionContext(Throwable $e)
Create the context array for logging the given exception.
protected array exceptionContext(Throwable $e)
Get the default exception context variables for logging.
protected array context()
Get the default context variables for logging.
protected Throwable mapException(Throwable $e)
Map the exception using a registered mapper if possible.
protected mixed renderViaCallbacks(Request $request, Throwable $e)
Try to render a response from request and exception via render callbacks.
protected Response|RedirectResponse renderExceptionResponse(Request $request, Throwable $e)
Render a default exception response if any.
protected Response|RedirectResponse unauthenticated(Request $request, AuthenticationException $exception)
Convert an authentication exception into a response.
protected Response convertValidationExceptionToResponse(ValidationException $e, Request $request)
Create a response object from the given validation exception.
protected Response|RedirectResponse invalid(Request $request, ValidationException $exception)
Convert a validation exception into a response.
protected JsonResponse invalidJson(Request $request, ValidationException $exception)
Convert a validation exception into a JSON response.
protected bool shouldReturnJson(Request $request, Throwable $e)
Determine if the exception handler response should be JSON.
protected Response|RedirectResponse prepareResponse(Request $request, Throwable $e)
Prepare a response for the given exception.
protected Response convertExceptionToResponse(Throwable $e)
Create a Symfony response for the given exception.
protected string renderExceptionContent(Throwable $e)
Get the response content for the given exception.
protected string renderExceptionWithCustomRenderer(Throwable $e)
Render an exception to a string using the registered ExceptionRenderer
.
protected string renderExceptionWithSymfony(Throwable $e, bool $debug)
Render an exception to a string using Symfony.
protected Response renderHttpException(HttpExceptionInterface $e)
Render the given HttpException.
protected void registerErrorViewPaths()
Register the error template hint paths.
protected string|null getHttpExceptionView(HttpExceptionInterface $e)
Get the view used to render HTTP exceptions.
protected Response|RedirectResponse toIlluminateResponse(Response $response, Throwable $e)
Map the given exception into an Illuminate response.
protected JsonResponse prepareJsonResponse(Request $request, Throwable $e)
Prepare a JSON response for the given exception.
protected array convertExceptionToArray(Throwable $e)
Convert the given exception to an array.
void renderForConsole(OutputInterface $output, Throwable $e)
internal | This method is not meant to be used or overwritten outside the framework. |
Render an exception to the console.
protected bool isHttpException(Throwable $e)
Determine if the given exception is an HTTP exception.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/10.x/Illuminate/Foundation/Exceptions/Handler.html