From 1e81165736048f52d762369a871ca9bb96d9f670 Mon Sep 17 00:00:00 2001 From: Marcus Burghardt Date: Fri, 5 Jul 2024 15:15:18 +0200 Subject: [PATCH] Minor update to show XML content with problem When working with OVAL it is not difficult spend a lot of time trying to identify a typo or an incorrect syntax. This commit include a minor update to help developers to see which content was causing an exception. This is specially helpful when multiple OVAL files are changed. Signed-off-by: Marcus Burghardt --- ssg/oval_object_model/oval_shorthand.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ssg/oval_object_model/oval_shorthand.py b/ssg/oval_object_model/oval_shorthand.py index 74a41b5f0c7..3491156770f 100644 --- a/ssg/oval_object_model/oval_shorthand.py +++ b/ssg/oval_object_model/oval_shorthand.py @@ -9,7 +9,11 @@ def _get_xml_element_from_string_shorthand(shorthand): valid_oval_xml_string = "{}{}{}".format(oval_header, shorthand, oval_footer).encode( "utf-8" ) - xml_element = ElementTree.fromstring(valid_oval_xml_string) + try: + xml_element = ElementTree.fromstring(valid_oval_xml_string) + except Exception as e: + print(f'{e}. Check the content below:') + print(valid_oval_xml_string) return xml_element.findall("./{%s}def-group/*" % OVAL_NAMESPACES.definition)