Improve formatting of the exceptions on the console.

This commit is contained in:
Vincent Driessen 2012-08-29 10:19:04 +02:00
parent a20deb2c52
commit daa8f38b4b
1 changed files with 4 additions and 3 deletions

View File

@ -23,7 +23,6 @@ from .version import VERSION
green = make_colorizer('darkgreen') green = make_colorizer('darkgreen')
yellow = make_colorizer('darkyellow') yellow = make_colorizer('darkyellow')
red = make_colorizer('darkred')
blue = make_colorizer('darkblue') blue = make_colorizer('darkblue')
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -429,8 +428,10 @@ class Worker(object):
def handle_exception(self, job, *exc_info): def handle_exception(self, job, *exc_info):
"""Walks the exception handler stack to delegate exception handling.""" """Walks the exception handler stack to delegate exception handling."""
exc_string = ''.join(traceback.format_exception(*exc_info)) exc_string = ''.join(
self.log.exception(red(exc_string)) traceback.format_exception_only(*exc_info[:2]) +
traceback.format_exception(*exc_info))
self.log.error(exc_string)
for handler in reversed(self._exc_handlers): for handler in reversed(self._exc_handlers):
self.log.debug('Invoking exception handler %s' % (handler,)) self.log.debug('Invoking exception handler %s' % (handler,))