From a77e0e6c78808ee953855151c45c165691ca87ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Mu=CC=88ller?= Date: Fri, 1 Nov 2024 20:58:24 +0100 Subject: [PATCH] TASK: Add nice error messages in event import Just a few checks and exceptions to guide users of the import. --- .../src/Processors/EventStoreImportProcessor.php | 4 ++++ Neos.Neos/Classes/Command/CrCommandController.php | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/Neos.ContentRepository.Export/src/Processors/EventStoreImportProcessor.php b/Neos.ContentRepository.Export/src/Processors/EventStoreImportProcessor.php index 50f4474f485..5ec22cf4764 100644 --- a/Neos.ContentRepository.Export/src/Processors/EventStoreImportProcessor.php +++ b/Neos.ContentRepository.Export/src/Processors/EventStoreImportProcessor.php @@ -47,6 +47,10 @@ public function __construct( if ($overrideContentStreamId) { $this->contentStreamId = $overrideContentStreamId; } + + if ($this->files->fileExists('events.jsonl') === false) { + throw new \InvalidArgumentException('The provided folder does not contain an events.jsonl file, so EventStoreImport is impossible.', 1730488421); + } } public function onMessage(\Closure $callback): void diff --git a/Neos.Neos/Classes/Command/CrCommandController.php b/Neos.Neos/Classes/Command/CrCommandController.php index d94cbeac1c9..bbdb02e33b0 100644 --- a/Neos.Neos/Classes/Command/CrCommandController.php +++ b/Neos.Neos/Classes/Command/CrCommandController.php @@ -91,6 +91,11 @@ public function exportCommand(string $path, string $contentRepository = 'default */ public function importCommand(string $path, string $contentRepository = 'default', bool $verbose = false): void { + if (!is_dir($path)) { + $this->outputLine('Argument "path" has to be the directory path to the stored events and additional resources.'); + $this->sendAndExit(1); + } + $filesystem = new Filesystem(new LocalFilesystemAdapter($path)); $contentRepositoryId = ContentRepositoryId::fromString($contentRepository);