Scyther.py: Improving Scyther python interface by giving options and filenames when reporting an error.

This commit is contained in:
Cas Cremers
2010-11-09 11:09:31 +01:00
parent fac14fc950
commit cbb66ea794
2 changed files with 51 additions and 3 deletions

View File

@@ -36,11 +36,22 @@ class ScytherError(Error):
backend
"""
def __init__(self, errorlist):
def __init__(self, errorlist,filenames=None,options=None):
self.errorlist = errorlist
self.filenames = filenames
self.options = options
def __str__(self):
s = "Scyther backend reported the following errors:\n"
s = "Scyther backend reported errors"
if len(self.filenames) == 0:
s = s + " for unknown files."
if len(self.filenames) == 1:
s = s + " for file %s" % (self.filenames)
if len(self.filenames) > 1:
s = s + " for files %s" % (self.filenames)
s = s + "\n"
s = s + "Options: '%s'\n\n" % (self.options)
S = s + "Error details:\n"
s = s + "\n".join(self.errorlist)
return s