Skip to content

Commit

Permalink
TASK: Do not try catch countPendingWorkspaceChanges
Browse files Browse the repository at this point in the history
... because it would lead to hard to debug code and is not expected to fail
  • Loading branch information
mhsdesign committed Oct 31, 2024
1 parent b7f9237 commit c86bd58
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
8 changes: 2 additions & 6 deletions Neos.Neos/Classes/Command/WorkspaceCommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -398,17 +398,13 @@ public function deleteCommand(string $workspace, bool $force = false, string $co

if ($crWorkspace->hasPublishableChanges()) {
if ($force === false) {
try {
$nodesCount = $this->workspacePublishingService->countPendingWorkspaceChanges($contentRepositoryId, $workspaceName);
} catch (\Exception) {
$nodesCount = 'NAN';
}
$nodesCount = $this->workspacePublishingService->countPendingWorkspaceChanges($contentRepositoryId, $workspaceName);
$this->outputLine(
'Did not delete workspace "%s" because it contains %s unpublished node(s).'
. ' Use --force to delete it nevertheless.',
[$workspaceName->value, $nodesCount]
);
$this->quit(5);
$this->quit(4);
}
$this->workspacePublishingService->discardAllWorkspaceChanges($contentRepositoryId, $workspaceName);
}
Expand Down
8 changes: 2 additions & 6 deletions Neos.Workspace.Ui/Classes/Controller/WorkspaceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,14 +374,10 @@ public function deleteAction(WorkspaceName $workspaceName): void
}

if ($workspace->hasPublishableChanges()) {
try {
$nodesCount = $this->workspacePublishingService->countPendingWorkspaceChanges($contentRepositoryId, $workspaceName);
} catch (\Exception) {
$nodesCount = null;
}
$nodesCount = $this->workspacePublishingService->countPendingWorkspaceChanges($contentRepositoryId, $workspaceName);
$message = $this->translator->translateById(
'workspaces.workspaceCannotBeDeletedBecauseOfUnpublishedNodes',
[$workspaceMetadata->title->value, $nodesCount ?? 'NAN'],
[$workspaceMetadata->title->value, $nodesCount],
$nodesCount,
null,
'Main',
Expand Down

0 comments on commit c86bd58

Please sign in to comment.