]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/rados: add ConnectionShutdown exception class
authorRamana Raja <rraja@redhat.com>
Thu, 12 Jan 2023 02:53:16 +0000 (21:53 -0500)
committerRamana Raja <rraja@redhat.com>
Thu, 11 May 2023 22:46:26 +0000 (18:46 -0400)
Signed-off-by: Ramana Raja <rraja@redhat.com>
(cherry picked from commit e452899013323def87a8b9e6edbdae66067a827c)

src/pybind/rados/rados.pyx

index abec5119d454b861ce56c3bbfe58f180e8e1b132..b956aeb3fd3979c45a5b86297faef145e44a9d98 100644 (file)
@@ -224,6 +224,13 @@ class IsConnected(Error):
                 "RADOS is connected error (%s)" % message, errno)
 
 
+class ConnectionShutdown(OSError):
+    """ `ConnectionShutdown` class, derived from `OSError` """
+    def __init__(self, message, errno=None):
+        super(ConnectionShutdown, self).__init__(
+                "RADOS connection was shutdown (%s)" % message, errno)
+
+
 IF UNAME_SYSNAME == "FreeBSD":
     cdef errno_to_exception = {
         errno.EPERM     : PermissionError,
@@ -240,6 +247,7 @@ IF UNAME_SYSNAME == "FreeBSD":
         errno.EISCONN   : IsConnected,
         errno.EINVAL    : InvalidArgumentError,
         errno.ENOTCONN  : NotConnected,
+        errno.ESHUTDOWN : ConnectionShutdown,
     }
 ELSE:
     cdef errno_to_exception = {
@@ -257,6 +265,7 @@ ELSE:
         errno.EISCONN   : IsConnected,
         errno.EINVAL    : InvalidArgumentError,
         errno.ENOTCONN  : NotConnected,
+        errno.ESHUTDOWN : ConnectionShutdown,
     }