Hide tracebacks, but not the ultimate error itself

This commit is contained in:
Peter Eckersley 2015-09-17 12:29:42 -07:00
parent b6461a1af5
commit 0e3eae153e

View file

@ -845,14 +845,17 @@ def _handle_exception(exc_type, exc_value, trace, args):
if issubclass(exc_type, errors.Error):
sys.exit(exc_value)
elif args is None:
sys.exit(
"An unexpected error occurred. Please see the logfile '{0}' "
"for more details.".format(logfile))
else:
sys.exit(
"An unexpected error occurred. Please see the logfiles in {0} "
"for more details.".format(args.logs_dir))
# Tell the user a bit about what happened, without overwhelming
# them with a full traceback
msg = "An unexpected error occurred.\n"
msg += traceback.format_exception_only(exc_type,exc_value)[0]
msg += "\nPlease see the "
if args is None:
msg += "logfile '{0}' for more details.".format(logfile)
else:
msg += "logfiles in {0} for more details.".format(args.logs_dir)
sys.exit(msg)
else:
sys.exit("".join(
traceback.format_exception(exc_type, exc_value, trace)))