From 1a4bde2b40dfe7b379770c6c1dbec1aeccf1471a Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Thu, 10 Jul 2014 16:17:25 -0600 Subject: [PATCH] Fix install_except_hook() Signed-off-by: Zack Cerza --- teuthology/worker.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/teuthology/worker.py b/teuthology/worker.py index e35a11d37e4..956e4ec6dcd 100644 --- a/teuthology/worker.py +++ b/teuthology/worker.py @@ -46,15 +46,11 @@ def install_except_hook(): Install an exception hook that first logs any uncaught exception, then raises it. """ - def log_exception(exception_class, exception, traceback): - logging.critical(''.join(format_tb(traceback))) - if not exception.message: - logging.critical(exception_class.__name__) - else: - logging.critical('{0}: {1}'.format( - exception_class.__name__, exception)) - # Now raise the exception like normal - sys.__excepthook__(exception_class, exception, traceback) + def log_exception(exc_type, exc_value, exc_traceback): + if not issubclass(exc_type, KeyboardInterrupt): + log.critical("Uncaught exception", exc_info=(exc_type, exc_value, + exc_traceback)) + sys.__excepthook__(exc_type, exc_value, exc_traceback) sys.excepthook = log_exception