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

This commit is contained in:
Calen Pennington
2012-07-12 14:04:09 -04:00
parent b48d08b2c5
commit d1d57e81cf

View File

@@ -172,12 +172,8 @@ class XmlDescriptor(XModuleDescriptor):
log.debug('filepath=%s, resources_fs=%s' % (filepath, system.resources_fs))
try:
with system.resources_fs.open(filepath) as file:
try:
definition_xml = cls.file_to_xml(file)
except:
log.exception("Failed to parse xml in file %s" % filepath)
raise
except ResourceNotFoundError:
definition_xml = cls.file_to_xml(file)
except (ResourceNotFoundError, etree.XMLSyntaxError):
log.exception('Unable to load file contents at path %s' % filepath)
return {'data': 'Error loading file contents at path %s' % filepath}