class GetResponseForExceptionEvent in Zircon Profile 8
Same name and namespace in other branches
- 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
- class \Symfony\Component\EventDispatcher\Event
- class \Symfony\Component\HttpKernel\Event\KernelEvent
- class \Symfony\Component\HttpKernel\Event\GetResponseEvent
- class \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent
- class \Symfony\Component\HttpKernel\Event\GetResponseEvent
- class \Symfony\Component\HttpKernel\Event\KernelEvent
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.
File
- vendor/
symfony/ http-kernel/ Event/ GetResponseForExceptionEvent.php, line 30
Namespace
Symfony\Component\HttpKernel\EventView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Event:: |
private | property | ||
Event:: |
private | property | ||
Event:: |
private | property | ||
Event:: |
public | function | Returns the EventDispatcher that dispatches this Event. | |
Event:: |
public | function | Gets the event's name. | |
Event:: |
public | function | Returns whether further event listeners should be triggered. | |
Event:: |
public | function | Stores the EventDispatcher that dispatches this Event. | |
Event:: |
public | function | Sets the event's name property. | |
Event:: |
public | function | Stops the propagation of the event to further event listeners. | |
GetResponseEvent:: |
private | property | The response object. | |
GetResponseEvent:: |
public | function | Returns the response object. | |
GetResponseEvent:: |
public | function | Returns whether a response was set. | |
GetResponseEvent:: |
public | function | Sets a response and stops event propagation. | |
GetResponseForExceptionEvent:: |
private | property | The exception object. | |
GetResponseForExceptionEvent:: |
public | function | Returns the thrown exception. | |
GetResponseForExceptionEvent:: |
public | function | Replaces the thrown exception. | |
GetResponseForExceptionEvent:: |
public | function |
Overrides KernelEvent:: |
|
KernelEvent:: |
private | property | The kernel in which this event was thrown. | |
KernelEvent:: |
private | property | The request the kernel is currently processing. | |
KernelEvent:: |
private | property | The request type the kernel is currently processing. One of HttpKernelInterface::MASTER_REQUEST and HttpKernelInterface::SUB_REQUEST. | |
KernelEvent:: |
public | function | Returns the kernel in which this event was thrown. | |
KernelEvent:: |
public | function | Returns the request the kernel is currently processing. | |
KernelEvent:: |
public | function | Returns the request type the kernel is currently processing. | |
KernelEvent:: |
public | function | Checks if this is a master request. |