Skip to content

Commit

Permalink
Add parsing check to handle exceptions in manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
David Conner committed May 21, 2024
1 parent 9e965be commit cad6edf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion flexbe_core/flexbe_core/behavior_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,13 @@ def _add_behavior_manifests(self, path, pkg=None):
if os.path.isdir(entry_path):
self._add_behavior_manifests(entry_path, pkg)
elif entry.endswith(".xml") and not entry.startswith("#"):
mrt = ET.parse(entry_path).getroot()
try:
mrt = ET.parse(entry_path).getroot()
except ET.ParseError as exc:
Logger.logerr(f"XML parsing error while loading behavior manifest\n for '{entry_path}'\n"
f" {exc}\n skipping loading of '{entry}' ...")
continue

# structure sanity check
if (mrt.tag != "behavior"
or len(mrt.findall(".//executable")) == 0
Expand Down

0 comments on commit cad6edf

Please sign in to comment.