- Improved error handling: any Scyther errors now raise an exception.

This can be dealt with accordingly. If no error occurs, we can just
  nicely assume the output is a claim list or something similar.
This commit is contained in:
ccremers
2007-01-27 21:42:16 +00:00
parent 6cd4d3d7b6
commit 70a718807e
5 changed files with 62 additions and 33 deletions

View File

@@ -9,6 +9,22 @@ class Error(Exception):
"""Base class for exceptions in this module."""
pass
class ScytherError(Error):
"""Exception raised for errors generated by the backend
Attributes:
errorlist -- list of error lines are retrieved from the
backend
"""
def __init__(self, errorlist):
self.errorlist = errorlist
def __str__(self):
s = "Scyther backend reported the following errors:\n"
s = s + "\n".join(self.errorlist)
return s
class InputError(Error):
"""Exception raised for errors in the input.