Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: Show the right error message if only child is published #3634

Open
wants to merge 6 commits into
base: 9.0
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions Classes/Controller/BackendServiceController.php
Expand Up @@ -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;
Expand Down Expand Up @@ -232,6 +233,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(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for improving the error ;)

I find the pattern of rethrowing the same error class a bit odd. I see that this pattern was used also in the code above and introduced via #3468

But I like to suggest to use a generic RuntimeException and additionally pass the original exception as third parameter for both cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a look and all of the exceptions are domain exceptions, so it would make more sense to rethrow that to me.
Looks like this now:

Bildschirmfoto 2023-12-08 um 09 08 32

'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();
Expand Down