diff options
Diffstat (limited to 'src/flake8/exceptions.py')
| -rw-r--r-- | src/flake8/exceptions.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/flake8/exceptions.py b/src/flake8/exceptions.py index 2b03795..71738b2 100644 --- a/src/flake8/exceptions.py +++ b/src/flake8/exceptions.py @@ -49,6 +49,26 @@ class InvalidSyntax(Flake8Exception): super(InvalidSyntax, self).__init__(*args, **kwargs) +class PluginRequestedUnknownParameters(Flake8Exception): + """The plugin requested unknown parameters.""" + + FORMAT = '"%(name)s" requested unknown parameters causing %(exc)s' + + def __init__(self, *args, **kwargs): + """Pop certain keyword arguments for initialization.""" + self.original_exception = kwargs.pop('exception') + self.plugin = kwargs.pop('plugin') + super(PluginRequestedUnknownParameters, self).__init__( + *args, + **kwargs + ) + + def __str__(self): + """Format our exception message.""" + return self.FORMAT % {'name': self.plugin.plugin_name, + 'exc': self.original_exception} + + class HookInstallationError(Flake8Exception): """Parent exception for all hooks errors.""" |
