cryptonas-branches/pythonrewrite/bin/CryptoBoxExceptions.py
lars 9321677078 unittests for CryptoBoxTools
mount/umount moved to separate volume plugins
volume name change moved to 'volume_props' plugin
webinterface for password change (luks) added
attribute "pluginCapabilities" added to plugins
attribute "requestAuth" added to plugins
http authentication implemented (for now: static user database)
2006-10-09 16:44:35 +00:00

107 lines
2.4 KiB
Python

"""
exceptions of the cryptobox package
"""
class CryptoBoxError(Exception):
"""base class for exceptions of the cryptobox"""
pass
class CBConfigError(CryptoBoxError):
"""any kind of error related to the configuration of a cryptobox"""
pass
class CBConfigUnavailableError(CBConfigError):
"""config file/input was not available at all"""
def __init__(self, source=None):
self.source = source
def __str__(self):
if self.source:
return "failed to access the configuration of the cryptobox: %s" % self.source
else:
return "failed to access the configuration of the cryptobox"
class CBConfigUndefinedError(CBConfigError):
"""a specific configuration setting was not defined"""
def __init__(self, section, name=None):
self.section = section
self.name = name
def __str__(self):
# is it a settings or a section?
if self.name:
# setting
return "undefined configuration setting: [%s]->%s - please check your configuration file" % (self.section, self.name)
else:
# section
return "undefined configuration section: [%s] - please check your configuration file" % (self.section, )
class CBConfigInvalidValueError(CBConfigError):
"""a configuration setting was invalid somehow"""
def __init__(self, section, name, value, reason):
self.section = section
self.name = name
self.value = value
self.reason = reason
def __str__(self):
return "invalid configuration setting [%s]->%s (%s): %s" % (self.section, self.name, self.value, self.reason)
class CBEnvironmentError(CryptoBoxError):
"""some part of the environment of the cryptobox is broken
e.g. the wrong version of a required program
"""
def __init__(self, desc):
self.desc = desc
def __str__(self):
return "misconfiguration detected: %s" % self.desc
class CBContainerError(CryptoBoxError):
"""any error raised while manipulating a cryptobox container"""
def __init__(self, desc):
self.desc = desc
def __str__(self):
return self.desc
class CBCreateError(CBContainerError):
pass
class CBVolumeIsActive(CBContainerError):
pass
class CBInvalidName(CBContainerError):
pass
class CBNameActivelyUsed(CBContainerError):
pass
class CBInvalidType(CBContainerError):
pass
class CBInvalidPassword(CBContainerError):
pass
class CBChangePasswordError(CBContainerError):
pass
class CBMountError(CBContainerError):
pass
class CBUmountError(CBContainerError):
pass