protected DefaultExceptionSubscriber::onFormatUnknown(GetResponseForExceptionEvent $event)
Handles an HttpExceptionInterface exception for unknown formats.
Parameters
\Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event: The event to process.
File
- core/lib/Drupal/Core/EventSubscriber/DefaultExceptionSubscriber.php, line 169
Class
- DefaultExceptionSubscriber
- Last-chance handler for exceptions.
Namespace
Drupal\Core\EventSubscriber
Code
protected function onFormatUnknown(GetResponseForExceptionEvent $event) { /** @var \Symfony\Component\HttpKernel\Exception\HttpExceptionInterface|\Exception $exception */ $exception = $event->getException(); $response = new Response($exception->getMessage(), $exception->getStatusCode(), $exception->getHeaders()); $event->setResponse($response); }
Please login to continue.