From d1d57e81cffb9151cd7b8ce7712b141ed7f3ab97 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Thu, 12 Jul 2012 14:04:09 -0400 Subject: [PATCH] Don't crash the system if you can't parse an xml file while loading a definition for a module descriptor --- common/lib/xmodule/xmodule/xml_module.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/common/lib/xmodule/xmodule/xml_module.py b/common/lib/xmodule/xmodule/xml_module.py index b0bfaebab5..ce41ff68bc 100644 --- a/common/lib/xmodule/xmodule/xml_module.py +++ b/common/lib/xmodule/xmodule/xml_module.py @@ -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}