mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-30 18:56:53 +00:00
Clean up usage of InvalidSyntax exception
This commit is contained in:
parent
cddf982a0a
commit
f434e9adf5
2 changed files with 9 additions and 4 deletions
|
|
@ -36,12 +36,17 @@ class InvalidSyntax(Flake8Exception):
|
|||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""Initialize our InvalidSyntax exception."""
|
||||
self.original_exception = exc = kwargs.pop('exception')
|
||||
self.error_message = str(exc) if exc is not None else ''
|
||||
exception = kwargs.pop('exception', None)
|
||||
self.original_exception = exception
|
||||
self.error_message = str(exception)
|
||||
self.error_code = 'E902'
|
||||
self.line_number = 1
|
||||
self.column_number = 0
|
||||
super(InvalidSyntax, self).__init__(*args, **kwargs)
|
||||
super(InvalidSyntax, self).__init__(
|
||||
self.error_message,
|
||||
*args,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
||||
class PluginRequestedUnknownParameters(Flake8Exception):
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ class FileProcessor(object):
|
|||
# course, I'm going to be unsurprised to be proven wrong at a later
|
||||
# date.
|
||||
except tokenize.TokenError as exc:
|
||||
raise exceptions.InvalidSyntax(str(exc), exception=exc)
|
||||
raise exceptions.InvalidSyntax(exception=exc)
|
||||
|
||||
def line_for(self, line_number):
|
||||
"""Retrieve the physical line at the specified line number."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue