public function EnforcedFormResponseSubscriber::onKernelException in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/EventSubscriber/EnforcedFormResponseSubscriber.php \Drupal\Core\EventSubscriber\EnforcedFormResponseSubscriber::onKernelException()
- 9 core/lib/Drupal/Core/EventSubscriber/EnforcedFormResponseSubscriber.php \Drupal\Core\EventSubscriber\EnforcedFormResponseSubscriber::onKernelException()
Replaces the response in case an EnforcedResponseException was thrown.
File
- core/
lib/ Drupal/ Core/ EventSubscriber/ EnforcedFormResponseSubscriber.php, line 19
Class
- EnforcedFormResponseSubscriber
- Handle the EnforcedResponseException and deliver an EnforcedResponse.
Namespace
Drupal\Core\EventSubscriberCode
public function onKernelException(ExceptionEvent $event) {
if ($response = EnforcedResponse::createFromException($event
->getThrowable())) {
// Setting the response stops the event propagation.
$event
->setResponse($response);
}
}