mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-04 12:54:42 +00:00
display errors
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@866 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
a795fd19db
commit
7b521da086
1 changed files with 25 additions and 3 deletions
|
|
@ -80,13 +80,35 @@ class HtmlParser:
|
|||
class HtmlPrinter (HtmlParser):
|
||||
"""handles all functions by printing the function name and
|
||||
attributes"""
|
||||
def _print (self, *attrs):
|
||||
print self.mem, attrs, self.last_lineno(), self.last_column()
|
||||
|
||||
|
||||
def _errorfun (self, msg, name):
|
||||
"""print msg to stderr with name prefix"""
|
||||
pos = "%d:%d:" % (self.lineno(), self.column())
|
||||
print >> sys.stderr, name, pos, msg
|
||||
|
||||
|
||||
def error (self, msg):
|
||||
"""signal a filter/parser error"""
|
||||
self._errorfun(msg, "error:")
|
||||
|
||||
|
||||
def warning (self, msg):
|
||||
"""signal a filter/parser warning"""
|
||||
self._errorfun(msg, "warning:")
|
||||
|
||||
|
||||
def fatalError (self, msg):
|
||||
"""signal a fatal filter/parser error"""
|
||||
self._errorfun(msg, "fatal error:")
|
||||
|
||||
|
||||
def __getattr__ (self, name):
|
||||
self.mem = name
|
||||
return self._print
|
||||
|
||||
def _print (self, *attrs):
|
||||
print self.mem, attrs, self.last_lineno(), self.last_column()
|
||||
|
||||
|
||||
def _test():
|
||||
p = HtmlPrinter()
|
||||
|
|
|
|||
Loading…
Reference in a new issue