/
exceptions.py
105 lines (76 loc) · 2.13 KB
/
exceptions.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
"""
The exceptions module contains exceptions unique to the PyAuroraX library
"""
class AuroraXException(Exception):
def __init__(self, *args, **kwargs):
response = kwargs.pop("response", None)
self.response = response
self.request = kwargs.pop("request", None)
if (response is not None and not self.request and hasattr(response, "request")):
self.request = self.response.request
super(AuroraXException, self).__init__(*args, **kwargs)
class AuroraXNotFoundException(AuroraXException):
"""
The AuroraX record was not found
"""
pass
class AuroraXDuplicateException(AuroraXException):
"""
A duplicate record already exists
"""
pass
class AuroraXValidationException(AuroraXException):
"""
Validation of data failed
"""
pass
class AuroraXUnexpectedContentTypeException(AuroraXException):
"""
The API responded with an unexpected content type
"""
pass
class AuroraXMaxRetriesException(AuroraXException):
"""
The maximum number of retries for the request has been reached
"""
pass
class AuroraXBadParametersException(AuroraXException):
"""
Bad parameters were given in the request
"""
pass
class AuroraXUnauthorizedException(AuroraXException):
"""
A privileged operation was attempted without authorization
"""
pass
class AuroraXConflictException(AuroraXException):
"""
A conflict occurred while modifying records
"""
pass
class AuroraXUploadException(AuroraXException):
"""
Error occurred during upload operation
"""
pass
class AuroraXUnexpectedEmptyResponse(AuroraXException):
"""
An empty response was received when it wasn't expected
"""
pass
class AuroraXDataRetrievalException(AuroraXException):
"""
Error occurred while retrieving search data
"""
pass
class AuroraXTimeoutException(AuroraXException):
"""
A timeout was reached while communicating with the AuroraX API
"""
pass
class AuroraXSearchException(AuroraXException):
"""
An error occured in the API while performing a search
"""
pass