From 252f634c815048b786205db387880c79ea1b1956 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Mon, 30 May 2016 23:27:09 +0200 Subject: [PATCH] Hide tracebacks from default output --- vdirsyncer/cli/utils.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/vdirsyncer/cli/utils.py b/vdirsyncer/cli/utils.py index a2749d5..9c15495 100644 --- a/vdirsyncer/cli/utils.py +++ b/vdirsyncer/cli/utils.py @@ -138,13 +138,19 @@ def handle_cli_error(status_name=None): .format(e, BUGTRACKER_HOME) ) except Exception as e: + tb = sys.exc_info()[2] + import traceback + tb = traceback.format_tb(tb) if status_name: - msg = 'Unhandled exception occured for {}.'.format( + msg = 'Unknown error occured for {}'.format( coerce_native(status_name)) else: - msg = 'Unhandled exception occured.' + msg = 'Unknown error occured' - cli_logger.exception(msg) + msg += ': {}\nUse `-vdebug` to see the full traceback.'.format(e) + + cli_logger.error(msg) + cli_logger.debug(tb) def get_status_name(pair, collection):