Merge pull request #263 from jedie/11ae55c90d7c74c060cbe6fe5777cf24838ce74a
Display the error line on HTMLParser parse errors.
This commit is contained in:
@@ -16,7 +16,9 @@ class DefaultHtmlParser(ParserBase, HTMLParser):
|
|||||||
self.feed(self.content)
|
self.feed(self.content)
|
||||||
self.close()
|
self.close()
|
||||||
except Exception, err:
|
except Exception, err:
|
||||||
raise ParserError("Error while initializing HtmlParser: %s" % err)
|
lineno = err.lineno
|
||||||
|
line = self.content.splitlines()[lineno]
|
||||||
|
raise ParserError("Error while initializing HtmlParser: %s (line: %s)" % (err, repr(line)))
|
||||||
|
|
||||||
def handle_starttag(self, tag, attrs):
|
def handle_starttag(self, tag, attrs):
|
||||||
tag = tag.lower()
|
tag = tag.lower()
|
||||||
|
|||||||
Reference in New Issue
Block a user