Handle exceptions in the command-line instead of in the XMLRPC client plugin

This commit is contained in:
Rob Crittenden committed 2008-11-03 17:19:29 -05:00
1 parent 5ab203ef48
commit d53218a932
2 files changed
+11 -8

No files matched your search

+10
View File
@@ -377,6 +377,16 @@ class CLI(object):
if callable(cmd.output_for_cli):
cmd.output_for_cli(ret)
return 0
except errors.GenericError, err:
code = getattr(err,'faultCode',None)
faultString = getattr(err,'faultString',None)
if not code:
raise err
if code < errors.IPA_ERROR_BASE:
print "%s: %s" % (code, faultString)
else:
print "%s: %s" % (code, getattr(err,'__doc__',''))
return 1
except StandardError, e:
print e
return 2
+1 -8
View File
@@ -64,14 +64,7 @@ class xmlrpc(Backend):
print e[1]
except xmlrpclib.Fault, e:
err = errors.convertFault(e)
code = getattr(err,'faultCode',None)
faultString = getattr(err,'faultString',None)
if not code:
raise err
if code < errors.IPA_ERROR_BASE:
print "%s: %s" % (code, faultString)
else:
print "%s: %s" % (code, getattr(err,'__doc__',''))
raise err
return
api.register(xmlrpc)