exceptions.py 676 B

1234567891011121314151617181920212223242526
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. """
  4. Contains custom Exceptions used in ffstatus.
  5. """
  6. class SanityCheckError(Exception):
  7. """Thrown by the .sanitycheck() functions."""
  8. def __init__(self, source, message, exception=None):
  9. msg = '{{{0}}} {1}'.format(source, message)
  10. if exception is not None:
  11. msg += ': ' + str(exception)
  12. Exception.__init__(self, msg)
  13. class VpnKeyFormatError(Exception):
  14. """Thrown by BaseStorage on invalid VPN keys."""
  15. def __init__(self, key):
  16. Exception.__init__(self)
  17. self.key = key
  18. def __str__(self):
  19. return 'The VPN key has an invalid format: ' + repr(self.key)