archive mirror
 help / color / mirror / Atom feed
From: Martin Jansa <>
Cc:, Richard Purdie <>
Subject: [2.2][PATCH 3/4] cookerdata: Improve early exception handling
Date: Fri, 10 Mar 2023 21:45:18 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

From: Richard Purdie <>

Martin Jansa reported that if you put a syntax error into an imported
module such as in OE, no error is shown.

Part of the issue appears to be that the catch_parse_error() decorator only
catches certain exceptions and SyntaxError isn't one of them. As far as I can
tell we should remove all the special cases and use the more advanced code
in all cases, not just expansion errors.

I confirmed this now prints a proper error message for a syntax error.

Signed-off-by: Richard Purdie <>
 lib/bb/ | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/lib/bb/ b/lib/bb/
index 3555585c8..25eea827d 100644
--- a/lib/bb/
+++ b/lib/bb/
@@ -160,12 +160,7 @@ def catch_parse_error(func):
     def wrapped(fn, *args):
             return func(fn, *args)
-        except IOError as exc:
-            import traceback
-            parselog.critical(traceback.format_exc())
-            parselog.critical("Unable to parse %s: %s" % (fn, exc))
-            raise bb.BBHandledException()
-        except bb.data_smart.ExpansionError as exc:
+        except Exception as exc:
             import traceback
             bbdir = os.path.dirname(__file__) + os.sep
@@ -177,9 +172,6 @@ def catch_parse_error(func):
             parselog.critical("Unable to parse %s" % fn, exc_info=(exc_class, exc, tb))
             raise bb.BBHandledException()
-        except bb.parse.ParseError as exc:
-            parselog.critical(str(exc))
-            raise bb.BBHandledException()
     return wrapped

  parent reply	other threads:[~2023-03-10 20:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-10 20:45 [2.2][PATCH 1/4] utils: Allow to_boolean to support int values Martin Jansa
2023-03-10 20:45 ` [2.2][PATCH 2/4] cookerdata: Remove incorrect SystemExit usage Martin Jansa
2023-03-10 20:45 ` Martin Jansa [this message]
2023-03-10 20:45 ` [2.2][PATCH 4/4] cookerdata: Drop dubious exception handling code Martin Jansa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).