-
Notifications
You must be signed in to change notification settings - Fork 3
/
errors.py
61 lines (49 loc) · 1.56 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import json
class InvalidError(Exception):
status_code = 400
def __init__(self, message, status_code=None, payload=None):
Exception.__init__(self)
self.message = message
if status_code is not None:
self.status_code = status_code
def to_dict(self):
rv = dict()
rv["status"] = "INVALID_ERROR"
rv["response"] = self.message
return rv
class JsonError(Exception):
status_code = 400
def __init__(self, message, status_code=None, payload=None):
Exception.__init__(self)
self.message = message
if status_code is not None:
self.status_code = status_code
def to_dict(self):
rv = dict()
rv["status"] = "JSON_ERROR"
rv["response"] = self.message
return rv
class PPError(Exception):
status_code = 400
def __init__(self, message, status_code=None, payload=None):
Exception.__init__(self)
self.message = message
if status_code is not None:
self.status_code = status_code
def to_dict(self):
rv = dict()
rv["status"] = "PP_ERROR"
rv["response"] = self.message
return rv
class ConvError(Exception):
status_code = 400
def __init__(self, message, status_code=None, payload=None):
Exception.__init__(self)
self.message = message
if status_code is not None:
self.status_code = status_code
def to_dict(self):
rv = dict()
rv["status"] = "CONV_ERROR"
rv["response"] = self.message
return rv