Add logging of filename when module file parsing fails
This commit is contained in:
@@ -3,6 +3,10 @@ This config file runs the simplest dev environment"""
|
||||
|
||||
from .common import *
|
||||
|
||||
import logging
|
||||
import sys
|
||||
logging.basicConfig(stream=sys.stdout, )
|
||||
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
|
||||
@@ -2,7 +2,9 @@ from collections import MutableMapping
|
||||
from xmodule.x_module import XModuleDescriptor
|
||||
from lxml import etree
|
||||
import copy
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class LazyLoadingDict(MutableMapping):
|
||||
"""
|
||||
@@ -124,7 +126,11 @@ class XmlDescriptor(XModuleDescriptor):
|
||||
else:
|
||||
filepath = cls._format_filepath(xml_object.tag, filename)
|
||||
with system.resources_fs.open(filepath) as file:
|
||||
definition_xml = etree.parse(file).getroot()
|
||||
try:
|
||||
definition_xml = etree.parse(file).getroot()
|
||||
except:
|
||||
log.exception("Failed to parse xml in file %s" % filepath)
|
||||
raise
|
||||
|
||||
cls.clean_metadata_from_xml(definition_xml)
|
||||
return cls.definition_from_xml(definition_xml, system)
|
||||
|
||||
Reference in New Issue
Block a user