You are here

class GetResponseForExceptionEvent in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Event/GetResponseForExceptionEvent.php \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent

Allows to create a response for a thrown exception.

Call setResponse() to set the response that will be returned for the current request. The propagation of this event is stopped as soon as a response is set.

You can also call setException() to replace the thrown exception. This exception will be thrown if no response is set during processing of this event.

@author Bernhard Schussek <bschussek@gmail.com>

Hierarchy

Expanded class hierarchy of GetResponseForExceptionEvent

21 files declare their use of GetResponseForExceptionEvent
AccessDeniedSubscriber.php in core/modules/user/src/EventSubscriber/AccessDeniedSubscriber.php
Contains \Drupal\user\EventSubscriber\AccessDeniedSubscriber.
AuthenticationSubscriber.php in core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php
Contains \Drupal\Core\EventSubscriber\AuthenticationSubscriber.
CustomPageExceptionHtmlSubscriber.php in core/lib/Drupal/Core/EventSubscriber/CustomPageExceptionHtmlSubscriber.php
Contains \Drupal\Core\EventSubscriber\CustomPageExceptionHtmlSubscriber.
CustomPageExceptionHtmlSubscriberTest.php in core/tests/Drupal/Tests/Core/EventSubscriber/CustomPageExceptionHtmlSubscriberTest.php
Contains \Drupal\Tests\Core\EventSubscriber\CustomPageExceptionHtmlSubscriberTest.
DefaultExceptionHtmlSubscriber.php in core/lib/Drupal/Core/EventSubscriber/DefaultExceptionHtmlSubscriber.php
Contains \Drupal\Core\EventSubscriber\DefaultExceptionHtmlSubscriber.

... See full list

File

vendor/symfony/http-kernel/Event/GetResponseForExceptionEvent.php, line 30

Namespace

Symfony\Component\HttpKernel\Event
View source
class GetResponseForExceptionEvent extends GetResponseEvent {

  /**
   * The exception object.
   *
   * @var \Exception
   */
  private $exception;
  public function __construct(HttpKernelInterface $kernel, Request $request, $requestType, \Exception $e) {
    parent::__construct($kernel, $request, $requestType);
    $this
      ->setException($e);
  }

  /**
   * Returns the thrown exception.
   *
   * @return \Exception The thrown exception
   */
  public function getException() {
    return $this->exception;
  }

  /**
   * Replaces the thrown exception.
   *
   * This exception will be thrown if no response is set in the event.
   *
   * @param \Exception $exception The thrown exception
   */
  public function setException(\Exception $exception) {
    $this->exception = $exception;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Event::$dispatcher private property
Event::$name private property
Event::$propagationStopped private property
Event::getDispatcher Deprecated public function Returns the EventDispatcher that dispatches this Event.
Event::getName Deprecated public function Gets the event's name.
Event::isPropagationStopped public function Returns whether further event listeners should be triggered.
Event::setDispatcher Deprecated public function Stores the EventDispatcher that dispatches this Event.
Event::setName Deprecated public function Sets the event's name property.
Event::stopPropagation public function Stops the propagation of the event to further event listeners.
GetResponseEvent::$response private property The response object.
GetResponseEvent::getResponse public function Returns the response object.
GetResponseEvent::hasResponse public function Returns whether a response was set.
GetResponseEvent::setResponse public function Sets a response and stops event propagation.
GetResponseForExceptionEvent::$exception private property The exception object.
GetResponseForExceptionEvent::getException public function Returns the thrown exception.
GetResponseForExceptionEvent::setException public function Replaces the thrown exception.
GetResponseForExceptionEvent::__construct public function Overrides KernelEvent::__construct
KernelEvent::$kernel private property The kernel in which this event was thrown.
KernelEvent::$request private property The request the kernel is currently processing.
KernelEvent::$requestType private property The request type the kernel is currently processing. One of HttpKernelInterface::MASTER_REQUEST and HttpKernelInterface::SUB_REQUEST.
KernelEvent::getKernel public function Returns the kernel in which this event was thrown.
KernelEvent::getRequest public function Returns the request the kernel is currently processing.
KernelEvent::getRequestType public function Returns the request type the kernel is currently processing.
KernelEvent::isMasterRequest public function Checks if this is a master request.