[TNL-8235] - Fix breaking code by updating the exception when load_file fails. (#27368)

Co-authored-by: SaadYousaf <saadyousaf@A006-00314.local>
This commit is contained in:
Saad Yousaf
2021-04-19 13:30:14 +05:00
committed by GitHub
parent 65afd7fe75
commit bb3be323f0

View File

@@ -5,9 +5,7 @@ import copy
import json
import logging
import os
import sys
import six
from lxml import etree
from lxml.etree import Element, ElementTree, XMLParser
from xblock.core import XML_NAMESPACES
@@ -213,9 +211,7 @@ class XmlParserMixin:
return cls.file_to_xml(xml_file)
except Exception as err: # lint-amnesty, pylint: disable=broad-except
# Add info about where we are, but keep the traceback
msg = 'Unable to load file contents at path {} for item {}: {} '.format(
filepath, def_id, err)
six.reraise(Exception, msg, sys.exc_info()[2])
raise Exception(f'Unable to load file contents at path {filepath} for item {def_id}: {err}') from err
@classmethod
def load_definition(cls, xml_object, system, def_id, id_generator):