From bb3be323f04e07da09b9aae250defdda9dd28ad4 Mon Sep 17 00:00:00 2001 From: Saad Yousaf Date: Mon, 19 Apr 2021 13:30:14 +0500 Subject: [PATCH] [TNL-8235] - Fix breaking code by updating the exception when load_file fails. (#27368) Co-authored-by: SaadYousaf --- common/lib/xmodule/xmodule/xml_module.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/common/lib/xmodule/xmodule/xml_module.py b/common/lib/xmodule/xmodule/xml_module.py index 84e6c60641..ef6f01b8fe 100644 --- a/common/lib/xmodule/xmodule/xml_module.py +++ b/common/lib/xmodule/xmodule/xml_module.py @@ -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):