diff --git a/core/modules/workspaces/src/EntityOperations.php b/core/modules/workspaces/src/EntityOperations.php index 5caccf4a34f..588520bc833 100644 --- a/core/modules/workspaces/src/EntityOperations.php +++ b/core/modules/workspaces/src/EntityOperations.php @@ -130,7 +130,7 @@ class EntityOperations implements ContainerInjectionInterface { // Disallow any change to an unsupported entity when we are not in the // default workspace. if (!$this->workspaceInfo->isEntitySupported($entity)) { - throw new \RuntimeException('This entity can only be saved in the default workspace.'); + throw new \RuntimeException(sprintf('The "%s" entity type can only be saved in the default workspace.', $entity->getEntityTypeId())); } /** @var \Drupal\Core\Entity\ContentEntityInterface|\Drupal\Core\Entity\EntityPublishedInterface $entity */ diff --git a/core/modules/workspaces/tests/src/Kernel/WorkspaceInformationTest.php b/core/modules/workspaces/tests/src/Kernel/WorkspaceInformationTest.php index 17e561ffe8d..25370f544a0 100644 --- a/core/modules/workspaces/tests/src/Kernel/WorkspaceInformationTest.php +++ b/core/modules/workspaces/tests/src/Kernel/WorkspaceInformationTest.php @@ -172,7 +172,7 @@ class WorkspaceInformationTest extends KernelTestBase { // Check that unsupported entity types can not be saved in a workspace. $this->expectException(EntityStorageException::class); - $this->expectExceptionMessage('This entity can only be saved in the default workspace.'); + $this->expectExceptionMessage('The "entity_test" entity type can only be saved in the default workspace.'); $entity->save(); } diff --git a/core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php b/core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php index 341f37ed41d..f5a3b57eb9f 100644 --- a/core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php +++ b/core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php @@ -690,7 +690,7 @@ class WorkspaceIntegrationTest extends KernelTestBase { if (!$allowed) { $this->expectException(EntityStorageException::class); - $this->expectExceptionMessage('This entity can only be saved in the default workspace.'); + $this->expectExceptionMessage("The \"$entity_type_id\" entity type can only be saved in the default workspace."); } $entity->save(); } @@ -721,7 +721,7 @@ class WorkspaceIntegrationTest extends KernelTestBase { if (!$allowed) { $this->expectException(EntityStorageException::class); - $this->expectExceptionMessage('This entity can only be saved in the default workspace.'); + $this->expectExceptionMessage("The \"$entity_type_id\" entity type can only be saved in the default workspace."); } $entity->save(); }