Package biblio :: Package webquery :: Module errors
[hide private]
[frames] | no frames]

Source Code for Module biblio.webquery.errors

 1  #! /usr/bin/env python 
 2  # -*- coding: utf-8 -*- 
 3  """ 
 4  Various errors thrown by the the module. 
 5   
 6  """ 
 7   
 8  __docformat__ = 'restructuredtext en' 
 9   
10   
11  ### IMPORTS ### 
12   
13  import exceptions 
14   
15  __all__ = [ 
16     'ParseError', 
17     'QueryThrottleError', 
18     'QueryError', 
19  ] 
20   
21   
22  ### CONSTANTS & DEFINES ### 
23   
24  ### IMPLEMENTATION ### 
25   
26 -class QueryError (exceptions.ValueError):
27 """ 28 Raised when there is an problem with a queries reply. 29 """ 30
31 - def __init__ (self, msg):
32 """ 33 C'tor. 34 """ 35 exceptions.ValueError.__init__ (self, msg)
36 37
38 -class ParseError (exceptions.ValueError):
39 """ 40 Thrown when parsing webservice formats. 41 """ 42
43 - def __init__ (self, msg):
44 """ 45 C'tor. 46 """ 47 exceptions.ValueError.__init__ (self, msg)
48 49
50 -class QueryThrottleError (exceptions.RuntimeError):
51 """ 52 An exception to throw when a query limit has been exceeded. 53 54 It serves little purpose except to distinguish failures caused by exceeding 55 query limits. 56 57 """
58 - def __init__ (self, msg=None):
59 msg = msg or "query limit exceeded" 60 RuntimeError.__init__ (self, msg)
61 62 63 64 ### TEST & DEBUG ### 65
66 -def _doctest ():
67 import doctest 68 doctest.testmod()
69 70 71 ### MAIN ### 72 73 if __name__ == '__main__': 74 _doctest() 75 76 77 ### END ###################################################################### 78