class EnforcedResponseException in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Form/EnforcedResponseException.php \Drupal\Core\Form\EnforcedResponseException
 
Custom exception to break out of the main request and enforce a response.
Hierarchy
- class \Drupal\Core\Form\EnforcedResponseException extends \Drupal\Core\Form\Exception
 
Expanded class hierarchy of EnforcedResponseException
6 files declare their use of EnforcedResponseException
- authorize.php in core/
authorize.php  - Administrative script for running authorized file operations.
 - BigPipeResponseAttachmentsProcessor.php in core/
modules/ big_pipe/ src/ Render/ BigPipeResponseAttachmentsProcessor.php  - FieldBlock.php in core/
modules/ layout_builder/ src/ Plugin/ Block/ FieldBlock.php  - FieldBlockTest.php in core/
modules/ layout_builder/ tests/ src/ Kernel/ FieldBlockTest.php  - FormBuilderTest.php in core/
tests/ Drupal/ Tests/ Core/ Form/ FormBuilderTest.php  - Contains \Drupal\Tests\Core\Form\FormBuilderTest.
 
File
- core/
lib/ Drupal/ Core/ Form/ EnforcedResponseException.php, line 10  
Namespace
Drupal\Core\FormView source
class EnforcedResponseException extends \Exception {
  /**
   * The response to be enforced.
   *
   * @var \Symfony\Component\HttpFoundation\Response
   */
  protected $response;
  /**
   * Constructs a new enforced response exception.
   *
   * @param \Symfony\Component\HttpFoundation\Response $response
   *   The response to be enforced.
   * @param string $message
   *   (optional) The exception message.
   * @param int $code
   *   (optional) A user defined exception code.
   * @param \Exception $previous
   *   (optional) The previous exception for nested exceptions
   */
  public function __construct(Response $response, $message = "", $code = 0, \Exception $previous = NULL) {
    parent::__construct($message, $code, $previous);
    $this->response = $response;
  }
  /**
   * Return the response to be enforced.
   *
   * @returns \Symfony\Component\HttpFoundation\Response $response
   *   The response to be enforced.
   */
  public function getResponse() {
    return $this->response;
  }
}Members
| 
            Name | 
                  Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| 
            EnforcedResponseException:: | 
                  protected | property | The response to be enforced. | |
| 
            EnforcedResponseException:: | 
                  public | function | Return the response to be enforced. | |
| 
            EnforcedResponseException:: | 
                  public | function | Constructs a new enforced response exception. |