Commit d1d57e81 by Calen Pennington

Don't crash the system if you can't parse an xml file while loading a definition…

Don't crash the system if you can't parse an xml file while loading a definition for a module descriptor
parent b48d08b2
...@@ -172,12 +172,8 @@ class XmlDescriptor(XModuleDescriptor): ...@@ -172,12 +172,8 @@ class XmlDescriptor(XModuleDescriptor):
log.debug('filepath=%s, resources_fs=%s' % (filepath, system.resources_fs)) log.debug('filepath=%s, resources_fs=%s' % (filepath, system.resources_fs))
try: try:
with system.resources_fs.open(filepath) as file: with system.resources_fs.open(filepath) as file:
try: definition_xml = cls.file_to_xml(file)
definition_xml = cls.file_to_xml(file) except (ResourceNotFoundError, etree.XMLSyntaxError):
except:
log.exception("Failed to parse xml in file %s" % filepath)
raise
except ResourceNotFoundError:
log.exception('Unable to load file contents at path %s' % filepath) log.exception('Unable to load file contents at path %s' % filepath)
return {'data': 'Error loading file contents at path %s' % filepath} return {'data': 'Error loading file contents at path %s' % filepath}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment