public function DefaultExceptionSubscriber::onException

public DefaultExceptionSubscriber::onException(GetResponseForExceptionEvent $event)

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 183

Class

DefaultExceptionSubscriber
Last-chance handler for exceptions.

Namespace

Drupal\Core\EventSubscriber

Code

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

  $method = 'on' . $format;
  if (!method_exists($this, $method)) {
    if ($exception instanceof HttpExceptionInterface) {
      $this->onFormatUnknown($event);
    }
    else {
      $this->onHtml($event);
    }
    return;
  }
  $this->$method($event);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!EventSubscriber!DefaultExceptionSubscriber.php/function/DefaultExceptionSubscriber::onException/8.1.x