From: Ramana Raja Date: Sun, 5 Jul 2020 11:46:15 +0000 (+0530) Subject: pybind/cephfs: raise custom Exception with same arguments X-Git-Tag: v14.2.11~20^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F36180%2Fhead;p=ceph.git pybind/cephfs: raise custom Exception with same arguments ... so that's easier for a higher level application to handle it. Fixes: https://tracker.ceph.com/issues/46360 Signed-off-by: Ramana Raja (cherry picked from commit 8992489cab6c0d09244c0640c6ec1a0e0f486b5a) --- diff --git a/src/pybind/cephfs/cephfs.pyx b/src/pybind/cephfs/cephfs.pyx index 751c2ed9fb6e..7d8cabd004c4 100644 --- a/src/pybind/cephfs/cephfs.pyx +++ b/src/pybind/cephfs/cephfs.pyx @@ -298,7 +298,7 @@ ELSE: cdef make_ex(ret, msg): """ - Translate a librados return code into an exception. + Translate a libcephfs return code into an exception. :param ret: the return code :type ret: int @@ -310,7 +310,7 @@ cdef make_ex(ret, msg): if ret in errno_to_exception: return errno_to_exception[ret](ret, msg) else: - return Error(msg + ': {} [Errno {:d}]'.format(os.strerror(ret), ret)) + return OSError(ret, msg) class DirEntry(namedtuple('DirEntry',