summaryrefslogtreecommitdiff
path: root/src/pybind/rados.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/pybind/rados.py')
-rwxr-xr-xsrc/pybind/rados.py22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/pybind/rados.py b/src/pybind/rados.py
index 0f1ea31bdfb..dee4d800dff 100755
--- a/src/pybind/rados.py
+++ b/src/pybind/rados.py
@@ -62,19 +62,17 @@ def make_ex(ret, msg):
:returns: a subclass of :class:`Error`
"""
+ errors = {
+ errno.EPERM : PermissionError,
+ errno.ENOENT : ObjectNotFound,
+ errno.EIO : IOError,
+ errno.ENOSPC : NoSpace,
+ errno.EEXIST : ObjectExists,
+ errno.ENODATA : NoData
+ }
ret = abs(ret)
- if (ret == errno.EPERM):
- return PermissionError(msg)
- elif (ret == errno.ENOENT):
- return ObjectNotFound(msg)
- elif (ret == errno.EIO):
- return IOError(msg)
- elif (ret == errno.ENOSPC):
- return NoSpace(msg)
- elif (ret == errno.EEXIST):
- return ObjectExists(msg)
- elif (ret == errno.ENODATA):
- return NoData(msg)
+ if ret in errors:
+ return errors[ret](msg)
else:
return Error(msg + (": error code %d" % ret))