return (self.__class__, (self.message, self.errno))
class InvalidArgumentError(Error):
- pass
+ def __init__(self, message, errno=None):
+ super(InvalidArgumentError, self).__init__(
+ "RADOS invalid argument (%s)" % message, errno)
+
class OSError(Error):
""" `OSError` class, derived from `Error` """
class InterruptedOrTimeoutError(OSError):
""" `InterruptedOrTimeoutError` class, derived from `OSError` """
- pass
+ def __init__(self, message, errno=None):
+ super(InterruptedOrTimeoutError, self).__init__(
+ "RADOS interrupted or timeout (%s)" % message, errno)
class PermissionError(OSError):
""" `PermissionError` class, derived from `OSError` """
- pass
+ def __init__(self, message, errno=None):
+ super(PermissionError, self).__init__(
+ "RADOS permission error (%s)" % message, errno)
class PermissionDeniedError(OSError):
""" deal with EACCES related. """
- pass
+ def __init__(self, message, errno=None):
+ super(PermissionDeniedError, self).__init__(
+ "RADOS permission denied (%s)" % message, errno)
class ObjectNotFound(OSError):
""" `ObjectNotFound` class, derived from `OSError` """
- pass
+ def __init__(self, message, errno=None):
+ super(ObjectNotFound, self).__init__(
+ "RADOS object not found (%s)" % message, errno)
class NoData(OSError):
""" `NoData` class, derived from `OSError` """
- pass
+ def __init__(self, message, errno=None):
+ super(NoData, self).__init__(
+ "RADOS no data (%s)" % message, errno)
class ObjectExists(OSError):
""" `ObjectExists` class, derived from `OSError` """
- pass
+ def __init__(self, message, errno=None):
+ super(ObjectExists, self).__init__(
+ "RADOS object exists (%s)" % message, errno)
class ObjectBusy(OSError):
""" `ObjectBusy` class, derived from `IOError` """
- pass
+ def __init__(self, message, errno=None):
+ super(ObjectBusy, self).__init__(
+ "RADOS object busy (%s)" % message, errno)
class IOError(OSError):
""" `ObjectBusy` class, derived from `OSError` """
- pass
+ def __init__(self, message, errno=None):
+ super(IOError, self).__init__(
+ "RADOS I/O error (%s)" % message, errno)
class NoSpace(OSError):
""" `NoSpace` class, derived from `OSError` """
- pass
+ def __init__(self, message, errno=None):
+ super(NoSpace, self).__init__(
+ "RADOS no space (%s)" % message, errno)
class RadosStateError(Error):
""" `RadosStateError` class, derived from `Error` """
- pass
+ def __init__(self, message, errno=None):
+ super(RadosStateError, self).__init__(
+ "RADOS rados state (%s)" % message, errno)
class IoctxStateError(Error):
""" `IoctxStateError` class, derived from `Error` """
- pass
+ def __init__(self, message, errno=None):
+ super(IoctxStateError, self).__init__(
+ "RADOS Ioctx state error (%s)" % message, errno)
class ObjectStateError(Error):
""" `ObjectStateError` class, derived from `Error` """
- pass
+ def __init__(self, message, errno=None):
+ super(ObjectStateError, self).__init__(
+ "RADOS object state error (%s)" % message, errno)
class LogicError(Error):
""" `` class, derived from `Error` """
- pass
+ def __init__(self, message, errno=None):
+ super(LogicError, self).__init__(
+ "RADOS logic error (%s)" % message, errno)
class TimedOut(OSError):
""" `TimedOut` class, derived from `OSError` """
- pass
+ def __init__(self, message, errno=None):
+ super(TimedOut, self).__init__(
+ "RADOS timed out (%s)" % message, errno)
+
+
+class InProgress(Error):
+ """ `InProgress` class, derived from `Error` """
+ def __init__(self, message, errno=None):
+ super(InProgress, self).__init__(
+ "RADOS in progress error (%s)" % message, errno)
+
+
+class IsConnected(Error):
+ """ `IsConnected` class, derived from `Error` """
+ def __init__(self, message, errno=None):
+ super(IsConnected, self).__init__(
+ "RADOS is connected error (%s)" % message, errno)
IF UNAME_SYSNAME == "FreeBSD":
errno.EINTR : InterruptedOrTimeoutError,
errno.ETIMEDOUT : TimedOut,
errno.EACCES : PermissionDeniedError,
+ errno.EINPROGRESS : InProgress,
+ errno.EISCONN : IsConnected,
errno.EINVAL : InvalidArgumentError,
}
ELSE:
errno.EINTR : InterruptedOrTimeoutError,
errno.ETIMEDOUT : TimedOut,
errno.EACCES : PermissionDeniedError,
+ errno.EINPROGRESS : InProgress,
+ errno.EISCONN : IsConnected,
errno.EINVAL : InvalidArgumentError,
}