report extra info in verbose and if needed

pull/31264/head
Brian Coca 7 years ago committed by Brian Coca
parent 8f62be7b7c
commit 9c6d7ddeb5

@ -133,6 +133,11 @@ if __name__ == '__main__':
display.error("Unexpected Exception, this is probably a bug: %s" % to_text(e), wrap_text=False) display.error("Unexpected Exception, this is probably a bug: %s" % to_text(e), wrap_text=False)
if not have_cli_options or have_cli_options and cli.options.verbosity > 2: if not have_cli_options or have_cli_options and cli.options.verbosity > 2:
log_only = False log_only = False
if hasattr(e, 'orig_exc'):
display.vvv('\nexception type: %s' % to_text(type(e.orig_exc)))
why = to_text(e.orig_exc)
if to_text(e) != why:
display.vvv('\noriginal msg: %s' % why)
else: else:
display.display("to see the full traceback, use -vvv") display.display("to see the full traceback, use -vvv")
log_only = True log_only = True

@ -67,8 +67,6 @@ class AnsibleError(Exception):
self.message = '%s' % to_native(message) self.message = '%s' % to_native(message)
if orig_exc: if orig_exc:
self.orig_exc = orig_exc self.orig_exc = orig_exc
self.message += '\nexception type: %s' % to_native(type(orig_exc))
self.message += '\nexception: %s' % to_native(orig_exc)
self.tb = ''.join(traceback.format_tb(sys.exc_info()[2])) self.tb = ''.join(traceback.format_tb(sys.exc_info()[2]))

Loading…
Cancel
Save