Skip to content

Commit

Permalink
pybind/rbd: normalize errno exception
Browse files Browse the repository at this point in the history
The code meant to do so but actually it does not ...

Signed-off-by: songweibin <[email protected]>
  • Loading branch information
Songweibin committed Apr 2, 2018
1 parent 1b7d2fe commit 7483903
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/pybind/rbd/rbd.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -1610,7 +1610,6 @@ cdef class Group(object):
:type name: str
:raises: :class:`ObjectNotFound`
:raises: :class:`ObjectExists`
:raises: :class:`InvalidArgument`
:raises: :class:`FunctionNotSupported`
"""
Expand Down Expand Up @@ -1660,7 +1659,6 @@ cdef class Group(object):
:type name: str
:raises: :class:`ObjectNotFound`
:raises: :class:`ObjectExists`
:raises: :class:`InvalidArgument`
:raises: :class:`FunctionNotSupported`
"""
Expand Down

0 comments on commit 7483903

Please sign in to comment.