DefaultExceptionSubscriber::onFormatUnknown

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);
}
doc_Drupal
2016-10-29 09:01:40
Comments
Leave a Comment

Please login to continue.