-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy patherrors.py
40 lines (24 loc) · 1023 Bytes
/
errors.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
class AdnError(Exception):
pass
class AdnAPIException(AdnError):
def __init__(self, api_response):
super(AdnAPIException, self).__init__(api_response.meta.error_message)
self.response = api_response
self.error_id = api_response.meta.get('error_id')
self.error_slug = api_response.meta.get('error_slug')
def __str__(self):
return "%s error_id: %s error_slug: %s" % (super(AdnAPIException, self).__str__(), self.error_id, self.error_slug)
class AdnBadRequestAPIException(AdnAPIException):
def __init__(self, response):
response.meta.error_message = response.meta.error_message.replace('Bad Request: ', '')
super(AdnBadRequestAPIException, self).__init__(response)
class AdnAuthAPIException(AdnAPIException):
pass
class AdnRateLimitAPIException(AdnAPIException):
pass
class AdnInsufficientStorageException(AdnAPIException):
pass
class AdnPermissionDenied(AdnAPIException):
pass
class AdnMissing(AdnAPIException):
pass