Package SPARQLWrapper :: Module SPARQLExceptions
[hide private]
[frames] | no frames]

Source Code for Module SPARQLWrapper.SPARQLExceptions

 1  # -*- coding: utf-8 -*- 
 2   
 3  """ 
 4   
 5  SPARQL Wrapper exceptions 
 6   
 7  @authors: U{Ivan Herman<http://www.ivan-herman.net>}, U{Sergio Fernández<http://www.wikier.org>}, U{Carlos Tejo Alonso<http://www.dayures.net>} 
 8  @organization: U{World Wide Web Consortium<http://www.w3.org>} and U{Foundation CTIC<http://www.fundacionctic.org/>}. 
 9  @license: U{W3C® SOFTWARE NOTICE AND LICENSE<href="http://www.w3.org/Consortium/Legal/copyright-software">} 
10   
11  """ 
12   
13   
14 -class SPARQLWrapperException(Exception):
15 """ 16 Base class for SPARQL Wrapper exceptions 17 """ 18 19 msg = "an exception has occurred" 20
21 - def __init__(self, response=None):
22 if response: 23 formatted_msg = "%s: %s. \n\nResponse:\n%s" % (self.__class__.__name__, self.msg, response) 24 else: 25 formatted_msg = "%s: %s." % (self.__class__.__name__, self.msg) 26 27 super(SPARQLWrapperException, self).__init__(formatted_msg)
28
29 -class EndPointInternalError(SPARQLWrapperException):
30 """ 31 Exception type for 500 Internal Server Error responses. 32 """ 33 34 msg = "endpoint returned code 500 and response"
35 36
37 -class QueryBadFormed(SPARQLWrapperException):
38 """ 39 Query Bad Formed exception 40 """ 41 42 msg = "a bad request has been sent to the endpoint, probably the sparql query is bad formed"
43 44
45 -class EndPointNotFound(SPARQLWrapperException):
46 """ 47 End Point Not Found exception 48 """ 49 50 msg = "it was impossible to connect with the endpoint in that address, check if it is correct"
51