When requesting an instance for a plugin, \Drupal\Component\Plugin\Factory\DefaultFactory throws an exception telling you there is no plugin class defined, even if the entire plugin is unknown to the system. We should throw a dedicated exception when the plugin does not exist, so it's much clearer that the plugin ID contains a type or that the system can't find the plugin.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | drupal_2113913_2.patch | 822 bytes | xano |
| #1 | drupal_2113913_1.patch | 2.04 KB | xano |
Comments
Comment #1
xanoHere is a partial test. I'm still trying to wrap my head around getMock().
Comment #2
xanoI'm actually not quite sure how to test this. It's not an API implementation and we'd have to test the human-readable exception message, as we use PluginException for any kind of plugin-related exception.
Comment #3
amateescu commentedDuplicate of #1846070: Improve exception messages when plugins cannot be found
Comment #4
mpp commentedComment #5
rajeshramvani commentedThis error exist still when upgrading drupal 8 to 9 , getting below error.
Drupal\Component\Plugin\Exception\PluginException: The plugin (text_default) did not specify an instance class. in Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (line 79 of core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php).
if anyone has solution please provide.
thanks
Comment #6
summit commentedHi, I have the same, but then with taxonomy_index_tid.
Very open to solutions how to remove the instance class?
greetings, Martijn