diff options
Diffstat (limited to 'ipalib/cli.py')
-rw-r--r-- | ipalib/cli.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py index 732e38bb..8cf8d304 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -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 |