Show Exception Name in Shell Output

Currently, when the CLI encounters an exception, only the exception
message is shown.  However, the name of the exception can be quite
informative as well.

For instance, an error message might read "Cannot do xyz", which
simply indicates the operation was unsucessful.  However, the attached
exception name (HTTPNotImplemented, for instance) indicates the
*reason* that the call was unsuccessful.

Change-Id: I0298477bd9d40d98c95bb797c68c47dbc952b345
This commit is contained in:
Solly Ross 2014-03-18 15:55:58 -04:00
parent 14deb0194e
commit 0b1a29e7b0

@ -775,7 +775,9 @@ def main():
except Exception as e:
logger.debug(e, exc_info=1)
print("ERROR: %s" % strutils.safe_encode(six.text_type(e)),
details = {'name': strutils.safe_encode(e.__class__.__name__),
'msg': strutils.safe_encode(six.text_type(e))}
print("ERROR (%(name)s): %(msg)s" % details,
file=sys.stderr)
sys.exit(1)
except KeyboardInterrupt as e: