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.

CommentFileSizeAuthor
#2 drupal_2113913_2.patch822 bytesxano
#1 drupal_2113913_1.patch2.04 KBxano

Comments

xano’s picture

Status: Active » Needs work
StatusFileSize
new2.04 KB

Here is a partial test. I'm still trying to wrap my head around getMock().

xano’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new822 bytes

I'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.

amateescu’s picture

Status: Needs review » Closed (duplicate)
mpp’s picture

rajeshramvani’s picture

This 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

summit’s picture

Hi, I have the same, but then with taxonomy_index_tid.

Got error 'PHP message: Uncaught PHP Exception Drupal\\Component\\Plugin\\Exception\\PluginException: "The plugin (taxonomy_index_tid) did not specify an instance class." at /httpdocs/web/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php line 79'

Very open to solutions how to remove the instance class?
greetings, Martijn