public function HttpExceptionSubscriberBas8b7c:f320:99b9:690f:4595:cd17:293a:c069onException public HttpExceptionSubscriberBas8b7c:f320:99b9:690f:4595:cd17:293a:c069onException(GetResponseForExceptionEvent $event) Handles errors for this subscriber. Parameters  \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event: The event to process. File
 core/lib/Drupal/Core/EventSubscriber/HttpExceptionSubscriberBase.php, line 80  Class
 
HttpExceptionSubscriberBase  Utility base class for exception subscribers.  Namespace Drupal\Core\EventSubscriber Code public function onException(GetResponseForExceptionEvent $event) {
  $exception = $event->getException();

  // Make the exception available for example when rendering a block.
  $request = $event->getRequest();
  $request->attributes->set('exception', $exception);

  $handled_formats = $this->getHandledFormats();

  $format = $request->query->get(MainContentViewSubscriber8b7c:f320:99b9:690f:4595:cd17:293a:c069WRAPPER_FORMAT, $request->getRequestFormat());

  if ($exception instanceof HttpExceptionInterface && (empty($handled_formats) || in_array($format, $handled_formats))) {
    $method = 'on' . $exception->getStatusCode();
    // We want to allow the method to be called and still not set a response
    // if it has additional filtering logic to determine when it will apply.
    // It is therefore the method's responsibility to set the response on the
    // event if appropriate.
    if (method_exists($this, $method)) {
      $this->$method($event);
    }
  }
}


    
{'path': 'public/docs/drupal~8/core-lib-drupal-core-eventsubscriber-httpexceptionsubscriberbase.php/function/httpexceptionsubscriberbase-onexception/8.1.x.html', 'source': 'DevDocs.IO'}