From 20397f8d4b399e27268bb6f29be01739beb95b5f Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 9 Oct 2020 17:39:20 +0100 Subject: bitbake: command: Ensure exceptions inheriting from BBHandledException are visible Previous changes allowed BBHandledException to be detected but not exceptions which inherit from it. Fix this. The code really needs totally reworking to preserve the exceptions. [YOCTO #14054] (Bitbake rev: ef762d92df6c2554c6248e80212f984d9ec4c651) Signed-off-by: Richard Purdie --- bitbake/lib/bb/command.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'bitbake') diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py index f8c6a03bb9..dd77cdd6e2 100644 --- a/bitbake/lib/bb/command.py +++ b/bitbake/lib/bb/command.py @@ -81,8 +81,12 @@ class Command: result = command_method(self, commandline) except CommandError as exc: return None, exc.args[0] - except (Exception, SystemExit): + except (Exception, SystemExit) as exc: import traceback + if isinstance(exc, bb.BBHandledException): + # We need to start returning real exceptions here. Until we do, we can't + # tell if an exception is an instance of bb.BBHandledException + return None, "bb.BBHandledException()\n" + traceback.format_exc() return None, traceback.format_exc() else: return result, None -- cgit v1.2.3-54-g00ecf