- 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:
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user