From 754c71c628a7505b0d6ea722f9e0d500034c97b8 Mon Sep 17 00:00:00 2001 From: pKallert <91674611+pKallert@users.noreply.github.com> Date: Fri, 6 Oct 2023 15:40:32 +0200 Subject: [PATCH 1/4] Feature: Add custom error message --- Classes/Controller/BackendServiceController.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Classes/Controller/BackendServiceController.php b/Classes/Controller/BackendServiceController.php index 7c923fbcec..e8a780dca1 100644 --- a/Classes/Controller/BackendServiceController.php +++ b/Classes/Controller/BackendServiceController.php @@ -21,6 +21,7 @@ use Neos\ContentRepository\Core\Feature\WorkspacePublication\Dto\NodeIdToPublishOrDiscard; use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints; use Neos\ContentRepository\Core\SharedModel\Exception\NodeAggregateCurrentlyDoesNotExist; +use Neos\ContentRepository\Core\SharedModel\Exception\NodeAggregateDoesCurrentlyNotCoverDimensionSpacePoint; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; use Neos\Eel\FlowQuery\FlowQuery; @@ -243,6 +244,11 @@ public function publishAction(array $nodeContextPaths, string $targetWorkspaceNa 'Node could not be published, probably because of a missing parentNode. Please check that the parentNode has been published.', 1682762156 ); + } catch (NodeAggregateDoesCurrentlyNotCoverDimensionSpacePoint $e) { + throw new NodeAggregateDoesCurrentlyNotCoverDimensionSpacePoint( + 'Node could not be published, probably because the parentNode does not exist in the current dimension. Please check that the parentNode has been published.', + 1682762156 + ); } $success = new Success(); From b6f456db28cbcdffa1f03ff03709bcea8dc17d10 Mon Sep 17 00:00:00 2001 From: pKallert <91674611+pKallert@users.noreply.github.com> Date: Fri, 8 Dec 2023 09:06:18 +0100 Subject: [PATCH 2/4] Feature: use domain exception --- Classes/Controller/BackendServiceController.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Classes/Controller/BackendServiceController.php b/Classes/Controller/BackendServiceController.php index 68e2554a9f..eba3057f9a 100644 --- a/Classes/Controller/BackendServiceController.php +++ b/Classes/Controller/BackendServiceController.php @@ -228,15 +228,11 @@ public function publishAction(array $nodeContextPaths, string $targetWorkspaceNa NodeIdsToPublishOrDiscard::create(...$nodeIdentifiersToPublish) ) )->block(); - } catch (NodeAggregateCurrentlyDoesNotExist $e) { - throw new NodeAggregateCurrentlyDoesNotExist( - 'Node could not be published, probably because of a missing parentNode. Please check that the parentNode has been published.', - 1682762156 - ); - } catch (NodeAggregateDoesCurrentlyNotCoverDimensionSpacePoint $e) { - throw new NodeAggregateDoesCurrentlyNotCoverDimensionSpacePoint( - 'Node could not be published, probably because the parentNode does not exist in the current dimension. Please check that the parentNode has been published.', - 1682762156 + } catch (\DomainException $e) { + throw new \DomainException( + 'Node could not be published, probably because of a missing or unpublished parentNode. Please check that the parentNode has been published and exists in the current dimension.', + 1682762156, + $e ); } From 29a73a166afe1f3e2a545a577494b62875262785 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Fri, 12 Jan 2024 10:58:38 +0100 Subject: [PATCH 3/4] TASK: Improve Exceptionhandling in BackendServiceController --- Classes/Controller/BackendServiceController.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Classes/Controller/BackendServiceController.php b/Classes/Controller/BackendServiceController.php index eba3057f9a..3f74a583bc 100644 --- a/Classes/Controller/BackendServiceController.php +++ b/Classes/Controller/BackendServiceController.php @@ -228,10 +228,16 @@ public function publishAction(array $nodeContextPaths, string $targetWorkspaceNa NodeIdsToPublishOrDiscard::create(...$nodeIdentifiersToPublish) ) )->block(); - } catch (\DomainException $e) { - throw new \DomainException( - 'Node could not be published, probably because of a missing or unpublished parentNode. Please check that the parentNode has been published and exists in the current dimension.', - 1682762156, + } catch (NodeAggregateCurrentlyDoesNotExist $e) { + throw new \RuntimeException( + 'Node could not be published, probably because of a missing parentNode. Please check that the parentNode has been published.', + 1705053430, + $e + ); + } catch (NodeAggregateDoesCurrentlyNotCoverDimensionSpacePoint $e) { + throw new \RuntimeException( + 'Node could not be published, probably because the parentNode does not exist in the current dimension. Please check that the parentNode has been published.', + 1705053432, $e ); } From 3bfa6b18eaf72613140483f3e06bc6954a048c71 Mon Sep 17 00:00:00 2001 From: pKallert <91674611+pKallert@users.noreply.github.com> Date: Thu, 25 Jan 2024 08:36:35 +0100 Subject: [PATCH 4/4] Feature: Translate error messages --- Classes/Controller/BackendServiceController.php | 4 ++-- Resources/Private/Translations/en/Main.xlf | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Classes/Controller/BackendServiceController.php b/Classes/Controller/BackendServiceController.php index 921ee30308..9cd2fe440c 100644 --- a/Classes/Controller/BackendServiceController.php +++ b/Classes/Controller/BackendServiceController.php @@ -233,13 +233,13 @@ public function publishAction(array $nodeContextPaths, string $targetWorkspaceNa )->block(); } catch (NodeAggregateCurrentlyDoesNotExist $e) { throw new \RuntimeException( - 'Node could not be published, probably because of a missing parentNode. Please check that the parentNode has been published.', + $this->getLabel('NodeNotPublishedMissingParentNode'), 1705053430, $e ); } catch (NodeAggregateDoesCurrentlyNotCoverDimensionSpacePoint $e) { throw new \RuntimeException( - 'Node could not be published, probably because the parentNode does not exist in the current dimension. Please check that the parentNode has been published.', + $this->getLabel('NodeNotPublishedParentNodeNotInCurrentDimension'), 1705053432, $e ); diff --git a/Resources/Private/Translations/en/Main.xlf b/Resources/Private/Translations/en/Main.xlf index 29f22bbcf3..bc034679fe 100644 --- a/Resources/Private/Translations/en/Main.xlf +++ b/Resources/Private/Translations/en/Main.xlf @@ -394,6 +394,12 @@ For more information about the error please refer to the JavaScript console. + + Node could not be published, probably because of a missing parentNode. Please check that the parentNode has been published. + + + Node could not be published, probably because the parentNode does not exist in the current dimension. Please check that the parentNode has been published. +