From: Rishabh Dave Date: Fri, 13 Dec 2019 06:47:27 +0000 (+0530) Subject: pybind/cephfs: add method to get error code in Error and OSError X-Git-Tag: v15.1.0~258^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=be37f499f8f32a4470d1c54646a61191aaef9b97;p=ceph.git pybind/cephfs: add method to get error code in Error and OSError Add method to class Error and override it class OSError. Signed-off-by: Rishabh Dave --- diff --git a/src/pybind/cephfs/cephfs.pyx b/src/pybind/cephfs/cephfs.pyx index 6bf24b1b748..975abd26c58 100644 --- a/src/pybind/cephfs/cephfs.pyx +++ b/src/pybind/cephfs/cephfs.pyx @@ -183,7 +183,8 @@ cdef extern from "cephfs/libcephfs.h" nogil: class Error(Exception): - pass + def get_error_code(self): + return 1 class OSError(Error): @@ -195,6 +196,9 @@ class OSError(Error): def __str__(self): return '{} [Errno {}]'.format(self.strerror, self.errno) + def get_error_code(self): + return self.errno + class PermissionError(OSError): pass