public static function EnforcedResponse::createFromException in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Form/EnforcedResponse.php \Drupal\Core\Form\EnforcedResponse::createFromException()
Constructs a new enforced response from the given exception.
Note that it is necessary to traverse the exception chain when searching for an enforced response. Otherwise it would be impossible to find an exception thrown from within a twig template.
Parameters
\Exception $e: The exception where the enforced response is to be extracted from.
Return value
\Drupal\Core\Form\EnforcedResponse|NULL The enforced response or NULL if the exception chain does not contain a \Drupal\Core\Form\EnforcedResponseException exception.
1 call to EnforcedResponse::createFromException()
- EnforcedFormResponseSubscriber::onKernelException in core/
lib/ Drupal/ Core/ EventSubscriber/ EnforcedFormResponseSubscriber.php - Replaces the response in case an EnforcedResponseException was thrown.
File
- core/
lib/ Drupal/ Core/ Form/ EnforcedResponse.php, line 49 - Contains \Drupal\Core\Form\EnforcedResponse.
Class
- EnforcedResponse
- A wrapper containing a response which is to be enforced upon delivery.
Namespace
Drupal\Core\FormCode
public static function createFromException(\Exception $e) {
while ($e) {
if ($e instanceof EnforcedResponseException) {
return new static($e
->getResponse());
}
$e = $e
->getPrevious();
}
}