Redbrick User management tool
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.5 KiB

  1. #-----------------------------------------------------------------------------#
  2. # MODULE DESCRIPTION #
  3. #-----------------------------------------------------------------------------#
  4. """RedBrick Error Module; contains RedBrick exception classes."""
  5. #-----------------------------------------------------------------------------#
  6. # DATA #
  7. #-----------------------------------------------------------------------------#
  8. __version__ = '$Revision: 1.2 $'
  9. __author__ = 'Cillian Sharkey'
  10. #-----------------------------------------------------------------------------#
  11. # CLASSES #
  12. #-----------------------------------------------------------------------------#
  13. class RBError(Exception):
  14. """Base class for RedBrick exceptions"""
  15. def __init__(self, mesg):
  16. """Create new RBError object with given error message."""
  17. self.mesg = mesg
  18. def __str__(self):
  19. """Return exception error message."""
  20. return "ERROR: %s" % self.mesg
  21. class RBFatalError(RBError):
  22. """Class for fatal RedBrick exceptions"""
  23. def __str__(self):
  24. """Return exception error message."""
  25. return "FATAL: %s" % self.mesg
  26. class RBWarningError(RBError):
  27. """Class for warning RedBrick exceptions. These can be overrided."""
  28. def __str__(self):
  29. """Return exception error message."""
  30. return "WARNING: %s" % self.mesg