class DefaultExceptionHtmlSubscriber extends HttpExceptionSubscriberBase (View source)

Exception subscriber for handling core default HTML error pages.

Properties

protected HttpKernelInterface $httpKernel

The HTTP kernel.

protected LoggerInterface $logger

The logger instance.

protected RedirectDestinationInterface $redirectDestination

The redirect destination service.

protected UrlMatcherInterface $accessUnawareRouter

A router implementation which does not check access.

Methods

array
getHandledFormats()

Specifies the request formats this subscriber will respond to.

static int
getPriority()

Specifies the priority of all listeners in this class.

onException(ExceptionEvent $event)

Handles errors for this subscriber.

static array
getSubscribedEvents()

Registers the methods in this class that should be listeners.

__construct(HttpKernelInterface $http_kernel, LoggerInterface $logger, RedirectDestinationInterface $redirect_destination, UrlMatcherInterface $access_unaware_router)

Constructs a new DefaultExceptionHtmlSubscriber.

on4xx(ExceptionEvent $event)

Handles a 4xx error for HTML.

on401(ExceptionEvent $event)

Handles a 401 error for HTML.

on403(ExceptionEvent $event)

Handles a 403 error for HTML.

on404(ExceptionEvent $event)

Handles a 404 error for HTML.

makeSubrequest(ExceptionEvent $event, string $url, int $status_code)

Makes a subrequest to retrieve the default error page.

Details

protected array getHandledFormats()

Specifies the request formats this subscriber will respond to.

Return Value

array

An indexed array of the format machine names that this subscriber will attempt to process, such as "html" or "json". Returning an empty array will apply to all formats.

static protected int getPriority()

Specifies the priority of all listeners in this class.

The default priority is 1, which is very low. To have listeners that have a "first attempt" at handling exceptions return a higher priority.

Return Value

int

The event priority of this subscriber.

onException(ExceptionEvent $event)

Handles errors for this subscriber.

Parameters

ExceptionEvent $event

The event to process.

static array getSubscribedEvents()

Registers the methods in this class that should be listeners.

Return Value

array

An array of event listener definitions.

__construct(HttpKernelInterface $http_kernel, LoggerInterface $logger, RedirectDestinationInterface $redirect_destination, UrlMatcherInterface $access_unaware_router)

Constructs a new DefaultExceptionHtmlSubscriber.

Parameters

HttpKernelInterface $http_kernel

The HTTP kernel.

LoggerInterface $logger

The logger service.

RedirectDestinationInterface $redirect_destination

The redirect destination service.

UrlMatcherInterface $access_unaware_router

A router implementation which does not check access.

on4xx(ExceptionEvent $event)

Handles a 4xx error for HTML.

Parameters

ExceptionEvent $event

The event to process.

on401(ExceptionEvent $event)

Handles a 401 error for HTML.

Parameters

ExceptionEvent $event

The event to process.

on403(ExceptionEvent $event)

Handles a 403 error for HTML.

Parameters

ExceptionEvent $event

The event to process.

on404(ExceptionEvent $event)

Handles a 404 error for HTML.

Parameters

ExceptionEvent $event

The event to process.

protected makeSubrequest(ExceptionEvent $event, string $url, int $status_code)

Makes a subrequest to retrieve the default error page.

Parameters

ExceptionEvent $event

The event to process.

string $url

The path/url to which to make a subrequest for this error message.

int $status_code

The status code for the error being handled.