diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index ad78252..bf4c2c9 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -7,6 +7,8 @@ namespace Drupal\Core\Entity; +use Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException; +use Drupal\Component\Plugin\Exception\UnknownPluginException; use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\Factory\DefaultFactory; use Drupal\Component\Utility\NestedArray; @@ -167,7 +169,7 @@ public function getDefinition($entity_type_id, $exception_on_invalid = FALSE) { return NULL; } - throw new \InvalidArgumentException(sprintf('The "%s" entity type does not exist.', $entity_type_id)); + throw new UnknownPluginException($entity_type_id, sprintf('The "%s" entity type does not exist.', $entity_type_id)); } /** @@ -200,7 +202,7 @@ public function getListController($entity_type) { public function getFormController($entity_type, $operation) { if (!isset($this->controllers['form'][$operation][$entity_type])) { if (!$class = $this->getDefinition($entity_type, TRUE)->getForm($operation)) { - throw new \InvalidArgumentException(sprintf('The "%s" entity type did not specify a "%s" form class.', $entity_type, $operation)); + throw new InvalidPluginDefinitionException($entity_type, sprintf('The "%s" entity type did not specify a "%s" form class.', $entity_type, $operation)); } if (in_array('Drupal\Core\DependencyInjection\ContainerInjectionInterface', class_implements($class))) { $controller = $class::create($this->container); @@ -245,7 +247,7 @@ public function getController($entity_type, $controller_type, $controller_getter $class = $definition->getController($controller_type); } if (!$class) { - throw new \InvalidArgumentException(sprintf('The "%s" entity type did not specify a %s class.', $entity_type, $controller_type)); + throw new InvalidPluginDefinitionException($entity_type, sprintf('The "%s" entity type did not specify a %s class.', $entity_type, $controller_type)); } if (is_subclass_of($class, 'Drupal\Core\Entity\EntityControllerInterface')) { $controller = $class::createInstance($this->container, $definition); diff --git a/core/modules/config_translation/lib/Drupal/config_translation/Exception/InvalidMapperDefinitionException.php b/core/modules/config_translation/lib/Drupal/Component/Plugin/Exception/InvalidPluginDefinitionException.php similarity index 70% rename from core/modules/config_translation/lib/Drupal/config_translation/Exception/InvalidMapperDefinitionException.php rename to core/modules/config_translation/lib/Drupal/Component/Plugin/Exception/InvalidPluginDefinitionException.php index eb56606..e815399 100644 --- a/core/modules/config_translation/lib/Drupal/config_translation/Exception/InvalidMapperDefinitionException.php +++ b/core/modules/config_translation/lib/Drupal/Component/Plugin/Exception/InvalidPluginDefinitionException.php @@ -2,17 +2,15 @@ /** * @file - * Contains \Drupal\config_translation\Exception\InvalidMapperDefinitionException. + * Contains \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException. */ -namespace Drupal\config_translation\Exception; - -use Drupal\Component\Plugin\Exception\PluginException; +namespace Drupal\Component\Plugin\Exception; /** * Defines a class for invalid configuration mapper definition exceptions. */ -class InvalidMapperDefinitionException extends PluginException { +class InvalidPluginDefinitionException extends PluginException { /** * The plugin ID of the mapper. @@ -22,7 +20,7 @@ class InvalidMapperDefinitionException extends PluginException { protected $pluginId; /** - * Constructs a InvalidMapperDefinitionException. + * Constructs a InvalidPluginDefinitionException. * * @param string $plugin_id * The plugin ID of the mapper. diff --git a/core/modules/config_translation/lib/Drupal/config_translation/ConfigMapperManager.php b/core/modules/config_translation/lib/Drupal/config_translation/ConfigMapperManager.php index d787c14..ec7ae38 100644 --- a/core/modules/config_translation/lib/Drupal/config_translation/ConfigMapperManager.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/ConfigMapperManager.php @@ -8,7 +8,7 @@ namespace Drupal\config_translation; use Drupal\Component\Utility\String; -use Drupal\config_translation\Exception\InvalidMapperDefinitionException; +use Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Config\Schema\ArrayElement; use Drupal\Core\Config\TypedConfigManager; @@ -116,7 +116,7 @@ public function processDefinition(&$definition, $plugin_id) { parent::processDefinition($definition, $plugin_id); if (!isset($definition['base_route_name'])) { - throw new InvalidMapperDefinitionException($plugin_id, String::format("The plugin definition of the mapper '%plugin_id' does not contain a base_route_name.", array('%plugin_id' => $plugin_id))); + throw new InvalidPluginDefinitionException($plugin_id, String::format("The plugin definition of the mapper '%plugin_id' does not contain a base_route_name.", array('%plugin_id' => $plugin_id))); } }