]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph.in, pybind/rados/rados.pyx: Handle EINVAL better
authorDan Mick <dan.mick@redhat.com>
Tue, 18 Apr 2017 20:52:03 +0000 (13:52 -0700)
committerDan Mick <dan.mick@redhat.com>
Mon, 24 Apr 2017 22:43:26 +0000 (15:43 -0700)
Translate EINVAL to an exception type in rados.pyx
Print entire exception in ceph CLI

Signed-off-by: Dan Mick <dan.mick@redhat.com>
src/ceph.in
src/pybind/rados/rados.pyx

index 36a3d2a3b5c9e230f6df3f59a98e4b02d67c6b06..3ab1c222a3c8d4a3397dbd2dc7189e4f2b43ba07 100755 (executable)
@@ -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
index 586dc7458d2db3e8b58d8a6bf864a1b37f7a6269..983ea460efbe9e2b8753f6be412978a203899246 100644 (file)
@@ -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,
     }