summaryrefslogtreecommitdiff
path: root/xml/generate-introspection.py
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2022-07-04 14:06:39 -0500
committerFederico Mena Quintero <federico@gnome.org>2022-07-04 14:06:39 -0500
commitf70c5698514868f5b65ff212e17cdc92f6a012a0 (patch)
tree98b0bce9304ace9d9a6acfeb98282a9bd1fd9edb /xml/generate-introspection.py
parent4782572246b1b9e35affa02de708ca79a378a3c6 (diff)
downloadat-spi2-core-f70c5698514868f5b65ff212e17cdc92f6a012a0.tar.gz
generate-introspection.py: Add the problematic filename to XML parse exceptions
Registry.xml had malformed XML; this is fixed in the commit that removes "name" attributres from the the toplevel node elements. However, to catch invalid XML in the future, we do it in the Python script.
Diffstat (limited to 'xml/generate-introspection.py')
-rw-r--r--xml/generate-introspection.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/xml/generate-introspection.py b/xml/generate-introspection.py
index 03309101..a0b4d1ec 100644
--- a/xml/generate-introspection.py
+++ b/xml/generate-introspection.py
@@ -68,7 +68,11 @@ def generate_introspection (inputs, c_output_filename, h_output_filename):
for input_filename in inputs:
#Open the XML file and process includes.
- tree = ElementTree.parse (input_filename)
+ try:
+ tree = ElementTree.parse (input_filename)
+ except Exception as e:
+ raise type(e)(f"Invalid XML while parsing {input_filename}: {str(e)}")
+
root = tree.getroot ()
for itf in root.findall ("interface"):