#!/usr/bin/python # -*- coding: utf-8 -*- """ Contains custom Exceptions used in ffstatus. """ class SanityCheckError(Exception): """Thrown by the .sanitycheck() functions.""" def __init__(self, source, message, exception=None): msg = '{{{0}}} {1}'.format(source, message) if exception is not None: msg += ': ' + str(exception) Exception.__init__(self, msg) class VpnKeyFormatError(Exception): """Thrown by BaseStorage on invalid VPN keys.""" def __init__(self, key): Exception.__init__(self) self.key = key def __str__(self): return 'The VPN key has an invalid format: ' + repr(self.key)