class Fast404ExceptionHtmlSubscriber extends HttpExceptionSubscriberBase (View source)

High-performance 404 exception subscriber.

This subscriber will return a minimalist 404 response for HTML requests without running a full page theming operation.

Properties

protected HttpKernelInterface $httpKernel

The HTTP kernel.

protected ConfigFactoryInterface $configFactory

The config factory.

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(ConfigFactoryInterface $config_factory, HttpKernelInterface $http_kernel)

Constructs a new Fast404ExceptionHtmlSubscriber.

on404(ExceptionEvent $event)

Handles a 404 error for HTML.

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(ConfigFactoryInterface $config_factory, HttpKernelInterface $http_kernel)

Constructs a new Fast404ExceptionHtmlSubscriber.

Parameters

ConfigFactoryInterface $config_factory

The configuration factory.

HttpKernelInterface $http_kernel

The HTTP Kernel service.

on404(ExceptionEvent $event)

Handles a 404 error for HTML.

Parameters

ExceptionEvent $event

The event to process.