Canvas' component rendering robustness layer is too eager: catch all `\Throwable`s EXCEPT `EnforcedResponseException` and `FormAjaxException`, otherwise "form" components cannot work
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3535983. --> Reported by: [gábor hojtsy](https://www.drupal.org/user/4166) Related to !173 >>> <h3 id="overview">Overview</h3> <p>When forms are submitted if a response object is to be enforced, an EnforcedResponseException is thrown by core.</p> <p>From <code>core/lib/Drupal/Core/Form/EnforcedResponse.php</code></p> <pre> * The FormBuilder throws an EnforcedResponseException whenever a form<br> * desires to explicitly set a response object. Exception handlers capable of<br> * setting the response should extract the response object of such an exception<br> * using EnforcedResponse::createFromException(). Then wrap it into an<br> * EnforcedResponse object and replace the original response with the wrapped<br> * response.</pre><p>XB demo now has a webform component which renders fine, it submits fine but on submission, XB catches the EnforcedResponseException and that leads to failed rendering of the component:</p> <blockquote><p>Drupal\Core\Form\EnforcedResponseException occurred during rendering of component ded7bed0-4370-4186-bb97-2ec6490cf548 in Page Awesome Demo Experience Builder (1), field components:</p></blockquote> <p>Steps to reproduce:</p> <p>1. Install xb-demo<br> 2. Submit the webform. Check the resulting page and the logs.</p> <h3 id="proposed-resolution">Proposed resolution</h3> <p>Layout Builder rethrows this exception in <code>Drupal\layout_builder\Plugin\Block\FieldBlock</code> to allow for this flow to work.</p> <h3 id="ui-changes">User interface changes</h3> > Related issue: [Issue #2367555](https://www.drupal.org/node/2367555) > Related issue: [Issue #2995893](https://www.drupal.org/node/2995893) > Related issue: [Issue #3520484](https://www.drupal.org/node/3520484) > Related issue: [Issue #3517941](https://www.drupal.org/node/3517941)
issue