Merge branch 'bug/203'

This commit is contained in:
Ian Cordasco 2016-08-05 06:45:29 -05:00
commit 1c07453ef7
No known key found for this signature in database
GPG key ID: 656D3395E4A9791A
2 changed files with 9 additions and 9 deletions

View file

@ -36,17 +36,17 @@ class InvalidSyntax(Flake8Exception):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
"""Initialize our InvalidSyntax exception.""" """Initialize our InvalidSyntax exception."""
self.original_exception = kwargs.pop('exception') exception = kwargs.pop('exception', None)
self.original_exception = exception
self.error_message = str(exception)
self.error_code = 'E902' self.error_code = 'E902'
self.line_number = 1 self.line_number = 1
self.column_number = 0 self.column_number = 0
try: super(InvalidSyntax, self).__init__(
self.error_message = self.original_exception.message self.error_message,
except AttributeError: *args,
# On Python 3, the IOError is an OSError which has a **kwargs
# strerror attribute instead of a message attribute )
self.error_message = self.original_exception.strerror
super(InvalidSyntax, self).__init__(*args, **kwargs)
class PluginRequestedUnknownParameters(Flake8Exception): class PluginRequestedUnknownParameters(Flake8Exception):

View file

@ -247,7 +247,7 @@ class FileProcessor(object):
# course, I'm going to be unsurprised to be proven wrong at a later # course, I'm going to be unsurprised to be proven wrong at a later
# date. # date.
except tokenize.TokenError as exc: except tokenize.TokenError as exc:
raise exceptions.InvalidSyntax(exc.message, exception=exc) raise exceptions.InvalidSyntax(exception=exc)
def line_for(self, line_number): def line_for(self, line_number):
"""Retrieve the physical line at the specified line number.""" """Retrieve the physical line at the specified line number."""