Skip to content

Commit

Permalink
XMLResult: don't attempt to reraise exception with new message
Browse files Browse the repository at this point in the history
there is no way to know if the original exception has a compatible
constructor

instead log a message and re-raise original exception.
  • Loading branch information
gromgull committed May 14, 2017
1 parent 1cce4fd commit 3696c10
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions rdflib/plugins/sparql/results/xmlresults.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging

from xml.sax.saxutils import XMLGenerator
from xml.dom import XML_NAMESPACE
Expand All @@ -19,6 +20,8 @@
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:
Expand Down Expand Up @@ -47,10 +50,8 @@ def __init__(self, source):
try:
tree = etree.fromstring(xmlstring)
except Exception as e:
try:
raise e.__class__("error parsing %r: %s" % (xmlstring, e))
except:
raise e
log.exception("Error parsing XML results: %s"%xmlstring)
raise e

boolean = tree.find(RESULTS_NS_ET + 'boolean')
results = tree.find(RESULTS_NS_ET + 'results')
Expand Down

0 comments on commit 3696c10

Please sign in to comment.