diff mbox series

lib: oe: sbom: Improve SPDX parsing error debugging

Message ID 20260724153055.3930069-1-JPEWhacker@gmail.com
State Under Review
Headers show
Series lib: oe: sbom: Improve SPDX parsing error debugging | expand

Commit Message

Joshua Watt July 24, 2026, 3:30 p.m. UTC
Improves the debugging output when parsing an SPDX file fails by
reporting the file name (since this is not normally visible from the
backtrace). Continue to raise the exception after reporting the file
name to get the full backtrace.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 meta/lib/oe/sbom30.py | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/meta/lib/oe/sbom30.py b/meta/lib/oe/sbom30.py
index 28778651d5..e02382c3cc 100644
--- a/meta/lib/oe/sbom30.py
+++ b/meta/lib/oe/sbom30.py
@@ -977,6 +977,9 @@  def load_jsonld(d, path, required=False):
         if required:
             bb.fatal("No SPDX document named %s found" % path)
         return None
+    except Exception as e:
+        bb.error(f"Unable to parse SPDX document {path}: {e}")
+        raise e
 
     if not objset.doc:
         bb.fatal("SPDX Document %s has no SPDXDocument element" % path)