diff options
author | Joel Andres Granados <jgranado@redhat.com> | 2008-07-15 22:25:06 +0200 |
---|---|---|
committer | Joel Andres Granados <jgranado@redhat.com> | 2008-07-15 22:25:06 +0200 |
commit | 47057109a0a6c76cc1fc79419045fd9e243389d1 (patch) | |
tree | c55d5743217c8715d2a4fffa5299ef3210947833 /pyfirstaidkit/errors.py | |
parent | bbefa48fd749858c80f2cd44c9f00bed75bbeb13 (diff) | |
download | firstaidkit-47057109a0a6c76cc1fc79419045fd9e243389d1.tar.gz firstaidkit-47057109a0a6c76cc1fc79419045fd9e243389d1.tar.xz firstaidkit-47057109a0a6c76cc1fc79419045fd9e243389d1.zip |
Be more expressive in the error messages.
- This patch will append an "FAK_ERROR" string to the error message.
This will help them to be noticed when the user encounters them in
the log or the stdout.
- Create parent error class that has all the common qualities for the
error classes.
Diffstat (limited to 'pyfirstaidkit/errors.py')
-rw-r--r-- | pyfirstaidkit/errors.py | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/pyfirstaidkit/errors.py b/pyfirstaidkit/errors.py index 2c91d2e..02bbf27 100644 --- a/pyfirstaidkit/errors.py +++ b/pyfirstaidkit/errors.py @@ -16,26 +16,26 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -class InvalidFlowStateException(Exception): +class FAKException(Exception): + def __init__(self): + pass + def __str__(self): + return ("FAK_ERROR: %s" % self.message) + +class InvalidFlowStateException(FAKException): def __init__(self, flow): self.message="There appears to be an inconsistency with the %s " \ "varialbe. " % flow - def __str__(self): - return self.message -class InvalidFlowNameException(Exception): +class InvalidFlowNameException(FAKException): def __init__(self, name): - self.message="There are no flows by the name of %s" % name - def __str__(self): - return self.message + self.message="No flow by the name of %s was found." % name -class InvalidPluginNameException(Exception): +class InvalidPluginNameException(FAKException): def __init__(self, name): - self.message="No flows by the name of \"%s\" where found." % name - def __str__(self): - return self.message + self.message="No plugin by the name of \"%s\" was found." % name -class GeneralPluginException(Exception): +class GeneralPluginException(FAKException): """General exception This exception should be used for all exceptions that come from the @@ -44,5 +44,3 @@ class GeneralPluginException(Exception): def __init__(self, plugin, message): self.message="There was an exception in plugin %s with message %s"% \ (plugin,message) - def __str__(self): - return self.message |