Issue Bug Closed

#83777EXT form: uncaught exception in backend page module preview

Andreas Kießling 02/05/18, 13:39 updated 10/02/18, 10:51

Description

To protect the user editable form definitions, i configured a second file mount and moved the yaml files there.

Unfortunately, the backed preview hook does not catch the exception, that the LocalDriver throws, when i open my existing page with the form pointing to the old storage location, see
https://github.com/TYPO3/TYPO3.CMS/blob/160f8db69f423e4db4e645f3c751a707c989db0d/typo3/sysext/form/Classes/Hooks/FormPagePreviewRenderer.php#L89

#1314516809: File /user_upload/requestForm.yaml does not exist. (More information)

InvalidArgumentException thrown in file
/var/www/dist/typo3_src/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php in line 253.

IMHO, the preview hook should catch all exceptions, not just these configured ones, because otherwise i can’t even reconfigure / delete the for element with the page module.
I don’t know, if the NoSuchFileException will be thrown from another driver? But the message seems also wrong, since $messageText is only declared in the protected function below.

Possible fix:

                } catch (NoSuchFileException $e) {
                    $this->addInvalidFrameworkConfigurationFlashMessage($e);
                    $formLabel = $e->getMessage();
                } catch (ParseErrorException $e) {
                    $this->addInvalidFrameworkConfigurationFlashMessage($e);
                    $formLabel = sprintf(
                        $this->getLanguageService()->sL(self::L10N_PREFIX . 'tt_content.preview.invalidFrameworkConfiguration'),
                        $persistenceIdentifier
                    );
                } catch (\Exception $e) {
                    $this->addInvalidFrameworkConfigurationFlashMessage($e);
                    $formLabel = $e->getMessage();
                }

Reviews 2