Package lastfm :: Module error
[hide private]
[frames] | no frames]

Source Code for Module lastfm.error

 1  #!/usr/bin/env python 
 2   
 3  __author__ = "Abhinav Sarkar <abhinav@abhinavsarkar.net>" 
 4  __version__ = "0.2" 
 5  __license__ = "GNU Lesser General Public License" 
6 7 -class LastfmError(Exception):
8 """Base class for Lastfm errors"""
9 - def __init__(self, 10 message = None, 11 code = None):
12 super(LastfmError, self).__init__() 13 self._code = code 14 self._message = message
15 16 @property
17 - def code(self):
18 return self._code
19 20 @property
21 - def message(self):
22 return self._message
23
24 - def __str__(self):
25 return "%s" % self.message
26
27 -class InvalidServiceError(LastfmError):#2
28 pass 29
30 -class InvalidMethodError(LastfmError):#3
31 pass 32
33 -class AuthenticationFailedError(LastfmError):#4
34 pass 35
36 -class InvalidFormatError(LastfmError):#5
37 pass 38
39 -class InvalidParametersError(LastfmError):#6
40 pass 41
42 -class InvalidResourceError(LastfmError):#7
43 pass 44
45 -class OperationFailedError(LastfmError):#8
46 pass 47
48 -class InvalidSessionKeyError(LastfmError):#9
49 pass 50
51 -class InvalidApiKeyError(LastfmError):#10
52 pass 53
54 -class ServiceOfflineError(LastfmError):#11
55 pass 56
57 -class SubscribersOnlyError(LastfmError):#12
58 pass 59
60 -class InvalidMethodSignatureError(LastfmError):#13
61 pass 62
63 -class TokenNotAuthorizedError(LastfmError):#14
64 pass 65
66 -class TokenExpiredError(LastfmError):#15
67 pass 68 69 error_map = { 70 1: LastfmError, 71 2: InvalidServiceError, 72 3: InvalidMethodError, 73 4: AuthenticationFailedError, 74 5: InvalidFormatError, 75 6: InvalidParametersError, 76 7: InvalidResourceError, 77 8: OperationFailedError, 78 9: InvalidSessionKeyError, 79 10: InvalidApiKeyError, 80 11: ServiceOfflineError, 81 12: SubscribersOnlyError, 82 13: InvalidMethodSignatureError, 83 14: TokenNotAuthorizedError, 84 15: TokenExpiredError, 85 } 86