diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-03-10 21:46:00 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-03-14 15:05:30 +0000 |
commit | f8c7c22df834199cfae361965f34833fd365292f (patch) | |
tree | 2e3d1fecdcef5bd3e1030da6377363bc055f63ab /bitbake | |
parent | b217614969399c62bded1b84cd2e2b404c86c6a0 (diff) | |
download | poky-f8c7c22df834199cfae361965f34833fd365292f.tar.gz |
bitbake: cookerdata: Improve early exception handling
Martin Jansa reported that if you put a syntax error into an imported
module such as qa.py 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 qa.py syntax error.
(Bitbake rev: e66012bfda60ffe1658473e25879aa67909ae65f)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/cookerdata.py | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/bitbake/lib/bb/cookerdata.py b/bitbake/lib/bb/cookerdata.py index efa671aa07..e2dbb3b21c 100644 --- a/bitbake/lib/bb/cookerdata.py +++ b/bitbake/lib/bb/cookerdata.py | |||
@@ -160,12 +160,7 @@ def catch_parse_error(func): | |||
160 | def wrapped(fn, *args): | 160 | def wrapped(fn, *args): |
161 | try: | 161 | try: |
162 | return func(fn, *args) | 162 | return func(fn, *args) |
163 | except IOError as exc: | 163 | except Exception as exc: |
164 | import traceback | ||
165 | parselog.critical(traceback.format_exc()) | ||
166 | parselog.critical("Unable to parse %s: %s" % (fn, exc)) | ||
167 | raise bb.BBHandledException() | ||
168 | except bb.data_smart.ExpansionError as exc: | ||
169 | import traceback | 164 | import traceback |
170 | 165 | ||
171 | bbdir = os.path.dirname(__file__) + os.sep | 166 | bbdir = os.path.dirname(__file__) + os.sep |
@@ -177,9 +172,6 @@ def catch_parse_error(func): | |||
177 | break | 172 | break |
178 | parselog.critical("Unable to parse %s" % fn, exc_info=(exc_class, exc, tb)) | 173 | parselog.critical("Unable to parse %s" % fn, exc_info=(exc_class, exc, tb)) |
179 | raise bb.BBHandledException() | 174 | raise bb.BBHandledException() |
180 | except bb.parse.ParseError as exc: | ||
181 | parselog.critical(str(exc)) | ||
182 | raise bb.BBHandledException() | ||
183 | return wrapped | 175 | return wrapped |
184 | 176 | ||
185 | @catch_parse_error | 177 | @catch_parse_error |