XMLResult: don't attempt to reraise exception with new message
there is no way to know if the original exception has a compatible
constructor
instead log a message and re-raise original exception.
+import logging
from xml.sax.saxutils import XMLGenerator
from xml.dom import XML_NAMESPACE
@@ -19,6 +20,8 @@ from six import text_type
SPARQL_XML_NAMESPACE = u'http://www.w3.org/2005/sparql-results#'
RESULTS_NS_ET = '{%s}' % SPARQL_XML_NAMESPACE
+log = logging.getLogger(__name__)
+
"""A Parser for SPARQL results in XML:
@@ -47,9 +50,7 @@ class XMLResult(Result):
try:
tree = etree.fromstring(xmlstring)
except Exception as e:
- try:
- raise e.__class__("error parsing %r: %s" % (xmlstring, e))
- except:
+ log.exception("Error parsing XML results: %s"%xmlstring)
raise e
boolean = tree.find(RESULTS_NS_ET + 'boolean')
