From: songweibin Date: Mon, 2 Apr 2018 03:31:04 +0000 (+0800) Subject: pybind/rbd: normalize errno exception X-Git-Tag: v13.1.0~430^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=74839033f31c8002ead713415b4c1fd1ea15a5cd;p=ceph.git pybind/rbd: normalize errno exception The code meant to do so but actually it does not ... Signed-off-by: songweibin --- diff --git a/src/pybind/rbd/rbd.pyx b/src/pybind/rbd/rbd.pyx index 8da4e651457..3e74f12560d 100644 --- a/src/pybind/rbd/rbd.pyx +++ b/src/pybind/rbd/rbd.pyx @@ -538,13 +538,13 @@ class PermissionError(OSError): class ImageNotFound(OSError): pass -class ObjectNotFound(Error): +class ObjectNotFound(OSError): pass class ImageExists(OSError): pass -class ObjectExists(Error): +class ObjectExists(OSError): pass @@ -644,8 +644,8 @@ cdef make_ex(ret, msg, exception_map=errno_to_exception): :returns: a subclass of :class:`Error` """ ret = abs(ret) - if ret in errno_to_exception: - return errno_to_exception[ret](msg, errno=ret) + if ret in exception_map: + return exception_map[ret](msg, errno=ret) else: return OSError(msg, errno=ret) @@ -1610,7 +1610,6 @@ cdef class Group(object): :type name: str :raises: :class:`ObjectNotFound` - :raises: :class:`ObjectExists` :raises: :class:`InvalidArgument` :raises: :class:`FunctionNotSupported` """ @@ -1660,7 +1659,6 @@ cdef class Group(object): :type name: str :raises: :class:`ObjectNotFound` - :raises: :class:`ObjectExists` :raises: :class:`InvalidArgument` :raises: :class:`FunctionNotSupported` """