diff options
author | Chris Larson <chris_larson@mentor.com> | 2011-05-05 17:43:38 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-06-08 20:38:25 +0100 |
commit | 96e2ee1d730fa19665cca34c2cc3deb3fa5dfd2d (patch) | |
tree | 9c75b5c023be0bb02681d09cf42b1d4f358364c4 /bitbake/lib/bb/cooker.py | |
parent | a3efbb96f23a222c58f2f4114a75d2f98d7da11f (diff) | |
download | poky-96e2ee1d730fa19665cca34c2cc3deb3fa5dfd2d.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.
(Bitbake rev: ee48d628ee038bd72e1cd94aa75f5ccbacbcee4c)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index a15b81f233..641a839810 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -1225,7 +1225,7 @@ class CookerParser(object): | |||
1225 | raise | 1225 | raise |
1226 | except ParsingFailure as exc: | 1226 | except ParsingFailure as exc: |
1227 | self.shutdown(clean=False) | 1227 | self.shutdown(clean=False) |
1228 | bb.fatal('Error parsing %s: %s' % | 1228 | bb.fatal('Unable to parse %s: %s' % |
1229 | (exc.recipe, bb.exceptions.to_string(exc.realexception))) | 1229 | (exc.recipe, bb.exceptions.to_string(exc.realexception))) |
1230 | except bb.parse.ParseError as exc: | 1230 | except bb.parse.ParseError as exc: |
1231 | bb.fatal(str(exc)) | 1231 | bb.fatal(str(exc)) |
@@ -1233,13 +1233,11 @@ class CookerParser(object): | |||
1233 | logger.error('Unable to parse %s', exc.recipe) | 1233 | logger.error('Unable to parse %s', exc.recipe) |
1234 | sys.exit(1) | 1234 | sys.exit(1) |
1235 | except Exception as exc: | 1235 | except Exception as exc: |
1236 | import traceback | ||
1237 | etype, value, tb = sys.exc_info() | 1236 | etype, value, tb = sys.exc_info() |
1238 | formatted = bb.exceptions.format_extracted(value.traceback, limit=5) | 1237 | logger.error('Unable to parse %s', value.recipe, |
1239 | formatted.extend(traceback.format_exception_only(etype, value)) | 1238 | exc_info=(etype, value, exc.traceback)) |
1240 | |||
1241 | self.shutdown(clean=False) | 1239 | self.shutdown(clean=False) |
1242 | bb.fatal('Error parsing %s:\n%s' % (value.recipe, ''.join(formatted))) | 1240 | sys.exit(1) |
1243 | 1241 | ||
1244 | self.current += 1 | 1242 | self.current += 1 |
1245 | self.virtuals += len(result) | 1243 | self.virtuals += len(result) |