diff --git a/src/Plugin/AiCKEditor/SummarizeDocument.php b/src/Plugin/AiCKEditor/SummarizeDocument.php index 80e0b2ecf5f53fc09cd507fca1445b0c35902649..cd49ded2b7aae15477b55b235d0548d98f385bc7 100755 --- a/src/Plugin/AiCKEditor/SummarizeDocument.php +++ b/src/Plugin/AiCKEditor/SummarizeDocument.php @@ -196,15 +196,13 @@ final class SummarizeDocument extends AiCKEditorPluginBase { $document = $this->entityTypeManager->getStorage('media')->load($values['plugin_config']['document']); if (!$document instanceof MediaInterface) { - $this->logger->error('Could not load the selected document.'); - return $form['plugin_config']['response_text']['#value'] = 'Could not load the selected document.'; + throw new \Exception('Could not load the selected document.'); } $file_id = $document->getSource()->getSourceFieldValue($document); $file = $this->entityTypeManager->getStorage('file')->load($file_id); if (!$file instanceof FileInterface) { - $this->logger->error('Could not load the file from the selected document.'); - return $form['plugin_config']['response_text']['#value'] = 'Could not load the file from the selected document.'; + throw new \Exception('Could not load the file from the selected document.'); } $parser = new Parser();