You are here

public function DefaultExceptionSubscriber::onException in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/EventSubscriber/DefaultExceptionSubscriber.php \Drupal\Core\EventSubscriber\DefaultExceptionSubscriber::onException()

Handles errors for this subscriber.

Parameters

\Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event: The event to process.

File

core/lib/Drupal/Core/EventSubscriber/DefaultExceptionSubscriber.php, line 174
Contains \Drupal\Core\EventSubscriber\DefaultExceptionSubscriber.

Class

DefaultExceptionSubscriber
Last-chance handler for exceptions.

Namespace

Drupal\Core\EventSubscriber

Code

public function onException(GetResponseForExceptionEvent $event) {
  $format = $this
    ->getFormat($event
    ->getRequest());

  // If it's an unrecognized format, assume HTML.
  $method = 'on' . $format;
  if (!method_exists($this, $method)) {
    $method = 'onHtml';
  }
  $this
    ->{$method}($event);
}