From 5b4b6bc7f7b24cb02811905b065304ba6b7e6e07 Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Thu, 5 May 2011 19:06:35 -0700 Subject: bb.exceptions: add to_string convenience function (Bitbake rev: 17a64df7e91438ee3fe1f7095c319f700a5372f1) Signed-off-by: Chris Larson Signed-off-by: Richard Purdie --- bitbake/lib/bb/exceptions.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'bitbake/lib') diff --git a/bitbake/lib/bb/exceptions.py b/bitbake/lib/bb/exceptions.py index 13269de8c1..e134ae136d 100644 --- a/bitbake/lib/bb/exceptions.py +++ b/bitbake/lib/bb/exceptions.py @@ -53,3 +53,9 @@ def format_exception(etype, value, tb, context=1, limit=None, formatter=None): formatted.extend(format_extracted(tb, formatter, limit)) formatted.extend(traceback.format_exception_only(etype, value)) return formatted + +def to_string(exc): + if isinstance(exc, SystemExit): + if not isinstance(exc.code, basestring): + return 'Exited with "%d"' % exc.code + return str(exc) -- cgit v1.2.3-54-g00ecf