-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexception.py
43 lines (27 loc) · 962 Bytes
/
exception.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
41
42
43
class ApiError(Exception):
def __init__(self, status, message=None):
self.status = status
self.message = message
def __str__(self):
if self.message is None:
return self.status
else:
return "%s (%s)" % (self.status, self.message)
class TransportError(Exception):
def __init__(self, base_exception=None):
self.base_exception = base_exception
def __str__(self):
if self.base_exception:
return str(self.base_exception)
return "An unknown error occurred."
class HTTPError(TransportError):
def __init__(self, status_code):
self.status_code = status_code
def __str__(self):
return "HTTP Error: %d" % self.status_code
class Timeout(Exception):
pass
class _RetriableRequest(Exception):
pass
class _OverQueryLimit(ApiError, _RetriableRequest):
pass