From 96e2ee1d730fa19665cca34c2cc3deb3fa5dfd2d Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Thu, 5 May 2011 17:43:38 -0700 Subject: Shift exception formatting into the UI Now we use bb.exceptions to pass pickleable traceback entries to the UI, and the UI is free to do whatever it wants to do with this information. By default, the log formatter for the UIs formats it with bb.exceptions. This also means that all exceptions should now show 3 lines of context and limit to 5 entries. (Bitbake rev: ee48d628ee038bd72e1cd94aa75f5ccbacbcee4c) Signed-off-by: Chris Larson Signed-off-by: Richard Purdie --- bitbake/lib/bb/event.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'bitbake/lib/bb/event.py') diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index 4ff530fcb4..a3288b619b 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py @@ -30,6 +30,7 @@ except ImportError: import pickle import logging import atexit +import traceback import bb.utils # This is the pid for which we should generate the event. This is set when @@ -423,6 +424,12 @@ class LogHandler(logging.Handler): """Dispatch logging messages as bitbake events""" def emit(self, record): + if record.exc_info: + etype, value, tb = record.exc_info + if hasattr(tb, 'tb_next'): + tb = list(bb.exceptions.extract_traceback(tb, context=3)) + record.bb_exc_info = (etype, value, tb) + record.exc_info = None fire(record, None) def filter(self, record): -- cgit v1.2.3-54-g00ecf