diff options
author | Chris Larson <chris_larson@mentor.com> | 2011-05-05 17:43:38 -0700 |
---|---|---|
committer | Chris Larson <chris_larson@mentor.com> | 2011-05-16 12:39:42 -0700 |
commit | ee48d628ee038bd72e1cd94aa75f5ccbacbcee4c (patch) | |
tree | b7eeea9d13b7cbe51d1a7a8aa44b1e3d2f0a9df8 /lib/bb/event.py | |
parent | cae6bf031dc83ba0439d07584fdbbd4a962408a3 (diff) | |
download | bitbake-ee48d628ee038bd72e1cd94aa75f5ccbacbcee4c.tar.gz |
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.
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'lib/bb/event.py')
-rw-r--r-- | lib/bb/event.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/bb/event.py b/lib/bb/event.py index daca0a770..16d936c1b 100644 --- a/lib/bb/event.py +++ b/lib/bb/event.py @@ -422,8 +422,10 @@ class LogHandler(logging.Handler): def emit(self, record): if record.exc_info: - lines = traceback.format_exception(*record.exc_info, limit=5) - record.msg += '\n%s' % ''.join(lines) + 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) |