6
6
class PluginValidationError (Exception ):
7
7
""" plugin failed validation. """
8
8
9
+ def __init__ (self , plugin , message ):
10
+ self .plugin = plugin
11
+ super (Exception , self ).__init__ (message )
12
+
9
13
10
14
class PluginManager (object ):
11
15
""" Core Pluginmanager class which manages registration
@@ -178,13 +182,15 @@ def get_name(self, plugin):
178
182
def _verify_hook (self , hook , hookimpl ):
179
183
if hook .is_historic () and hookimpl .hookwrapper :
180
184
raise PluginValidationError (
185
+ hookimpl .plugin ,
181
186
"Plugin %r\n hook %r\n historic incompatible to hookwrapper" %
182
187
(hookimpl .plugin_name , hook .name ))
183
188
184
189
# positional arg checking
185
190
notinspec = set (hookimpl .argnames ) - set (hook .argnames )
186
191
if notinspec :
187
192
raise PluginValidationError (
193
+ hookimpl .plugin ,
188
194
"Plugin %r for hook %r\n hookimpl definition: %s\n "
189
195
"Argument(s) %s are declared in the hookimpl but "
190
196
"can not be found in the hookspec" %
@@ -202,6 +208,7 @@ def check_pending(self):
202
208
for hookimpl in (hook ._wrappers + hook ._nonwrappers ):
203
209
if not hookimpl .optionalhook :
204
210
raise PluginValidationError (
211
+ hookimpl .plugin ,
205
212
"unknown hook %r in plugin %r" %
206
213
(name , hookimpl .plugin ))
207
214
0 commit comments