Exception handler for sparql query