exc.py 890 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. """Cement core exceptions module."""
  2. class FrameworkError(Exception):
  3. """
  4. General framework (non-application) related errors.
  5. :param msg: The error message.
  6. """
  7. def __init__(self, msg):
  8. Exception.__init__(self)
  9. self.msg = msg
  10. def __str__(self):
  11. return self.msg
  12. class InterfaceError(FrameworkError):
  13. """Interface related errors."""
  14. pass
  15. class CaughtSignal(FrameworkError):
  16. """
  17. Raised when a defined signal is caught. For more information regarding
  18. signals, reference the
  19. `signal <http://docs.python.org/library/signal.html>`_ library.
  20. :param signum: The signal number.
  21. :param frame: The signal frame.
  22. """
  23. def __init__(self, signum, frame):
  24. msg = 'Caught signal %s' % signum
  25. super(CaughtSignal, self).__init__(msg)
  26. self.signum = signum
  27. self.frame = frame