From: Dan Mick Date: Tue, 18 Apr 2017 20:52:03 +0000 (-0700) Subject: ceph.in, pybind/rados/rados.pyx: Handle EINVAL better X-Git-Tag: v12.0.3~245^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=058ac8526cb9c9ee617d60f1e268da10e182ca2f;p=ceph.git ceph.in, pybind/rados/rados.pyx: Handle EINVAL better Translate EINVAL to an exception type in rados.pyx Print entire exception in ceph CLI Signed-off-by: Dan Mick --- diff --git a/src/ceph.in b/src/ceph.in index 36a3d2a3b5c9..3ab1c222a3c8 100755 --- a/src/ceph.in +++ b/src/ceph.in @@ -704,7 +704,7 @@ def main(): conffile=conffile) retargs = run_in_thread(cluster_handle.conf_parse_argv, childargs) except rados.Error as e: - print('Error initializing cluster client: {0}'.format(e), file=sys.stderr) + print('Error initializing cluster client: {0!r}'.format(e), file=sys.stderr) return 1 childargs = retargs diff --git a/src/pybind/rados/rados.pyx b/src/pybind/rados/rados.pyx index 586dc7458d2d..983ea460efbe 100644 --- a/src/pybind/rados/rados.pyx +++ b/src/pybind/rados/rados.pyx @@ -301,7 +301,7 @@ class Error(Exception): """ `Error` class, derived from `Exception` """ -class InvalidArgument(Error): +class InvalidArgumentError(Error): pass @@ -388,7 +388,8 @@ IF UNAME_SYSNAME == "FreeBSD": errno.ENOATTR : NoData, errno.EINTR : InterruptedOrTimeoutError, errno.ETIMEDOUT : TimedOut, - errno.EACCES : PermissionDeniedError + errno.EACCES : PermissionDeniedError, + errno.EINVAL : InvalidArgumentError, } ELSE: cdef errno_to_exception = { @@ -401,7 +402,8 @@ ELSE: errno.ENODATA : NoData, errno.EINTR : InterruptedOrTimeoutError, errno.ETIMEDOUT : TimedOut, - errno.EACCES : PermissionDeniedError + errno.EACCES : PermissionDeniedError, + errno.EINVAL : InvalidArgumentError, }