|
26 | 26 | ADVANCED_SEARCH_SORTING_CRITERIA = ("sha1", "firstseen", "threatname", "sampletype", "filecount", "size")
|
27 | 27 |
|
28 | 28 |
|
| 29 | +class WrongInputError(Exception): |
| 30 | + def __init__(self, message="This input type is not allowed"): |
| 31 | + super(WrongInputError, self).__init__(message) |
| 32 | + |
| 33 | + |
29 | 34 | class NotFoundError(Exception):
|
30 |
| - def __init__(self, message="Not found. No reference was found for this input"): |
| 35 | + def __init__(self, response_object, message="Not found. No reference was found for this input"): |
31 | 36 | super(NotFoundError, self).__init__(message)
|
32 | 37 |
|
| 38 | + self.response_object = response_object |
| 39 | + |
33 | 40 |
|
34 | 41 | class NoFileTypeError(Exception):
|
35 |
| - def __init__(self, message="There is no determinable file type"): |
| 42 | + def __init__(self, response_object, message="There is no determinable file type"): |
36 | 43 | super(NoFileTypeError, self).__init__(message)
|
37 | 44 |
|
38 |
| - |
39 |
| -class WrongInputError(Exception): |
40 |
| - def __init__(self, message="This input type is not allowed"): |
41 |
| - super(WrongInputError, self).__init__(message) |
| 45 | + self.response_object = response_object |
42 | 46 |
|
43 | 47 |
|
44 | 48 | class UnauthorizedError(Exception):
|
45 |
| - def __init__(self, message="The provided credentials are invalid"): |
| 49 | + def __init__(self, response_object, message="The provided credentials are invalid"): |
46 | 50 | super(UnauthorizedError, self).__init__(message)
|
47 | 51 |
|
| 52 | + self.response_object = response_object |
| 53 | + |
48 | 54 |
|
49 | 55 | class ForbiddenError(Exception):
|
50 |
| - def __init__(self, message="The provided credentials do not have the required rights to access this resource"): |
| 56 | + def __init__(self, response_object, |
| 57 | + message="The provided credentials do not have the required rights to access this resource"): |
51 | 58 | super(ForbiddenError, self).__init__(message)
|
52 | 59 |
|
| 60 | + self.response_object = response_object |
| 61 | + |
53 | 62 |
|
54 | 63 | class BadRequestError(Exception):
|
55 |
| - def __init__(self, message="Bad request created"): |
| 64 | + def __init__(self, response_object, message="Bad request created"): |
56 | 65 | super(BadRequestError, self).__init__(message)
|
57 | 66 |
|
| 67 | + self.response_object = response_object |
| 68 | + |
58 | 69 |
|
59 | 70 | class RequestTimeoutError(Exception):
|
60 |
| - def __init__(self, message="Request timed out"): |
| 71 | + def __init__(self, response_object, message="Request timed out"): |
61 | 72 | super(RequestTimeoutError, self).__init__(message)
|
62 | 73 |
|
| 74 | + self.response_object = response_object |
| 75 | + |
63 | 76 |
|
64 | 77 | class ConflictError(Exception):
|
65 |
| - def __init__(self, message="Can't complete the request due to a conflict"): |
| 78 | + def __init__(self, response_object, message="Can't complete the request due to a conflict"): |
66 | 79 | super(ConflictError, self).__init__(message)
|
67 | 80 |
|
| 81 | + self.response_object = response_object |
| 82 | + |
68 | 83 |
|
69 | 84 | class RequestTooLargeError(Exception):
|
70 |
| - def __init__(self, message="The request is too large"): |
| 85 | + def __init__(self, response_object, message="The request is too large"): |
71 | 86 | super(RequestTooLargeError, self).__init__(message)
|
72 | 87 |
|
| 88 | + self.response_object = response_object |
| 89 | + |
73 | 90 |
|
74 | 91 | class InternalServerError(Exception):
|
75 |
| - def __init__(self, message="Internal server error"): |
| 92 | + def __init__(self, response_object, message="Internal server error"): |
76 | 93 | super(InternalServerError, self).__init__(message)
|
77 | 94 |
|
| 95 | + self.response_object = response_object |
| 96 | + |
78 | 97 |
|
79 | 98 | class BadGatewayError(Exception):
|
80 |
| - def __init__(self, message="The server received an invalid response from another server"): |
| 99 | + def __init__(self, response_object, message="The server received an invalid response from another server"): |
81 | 100 | super(BadGatewayError, self).__init__(message)
|
82 | 101 |
|
| 102 | + self.response_object = response_object |
| 103 | + |
83 | 104 |
|
84 | 105 | class ServiceUnavailableError(Exception):
|
85 |
| - def __init__(self, message="Service unavailable"): |
| 106 | + def __init__(self, response_object, message="Service unavailable"): |
86 | 107 | super(ServiceUnavailableError, self).__init__(message)
|
87 | 108 |
|
| 109 | + self.response_object = response_object |
| 110 | + |
88 | 111 |
|
89 | 112 | class NotAllowedError(Exception):
|
90 |
| - def __init__(self, message="This method is not allowed"): |
| 113 | + def __init__(self, response_object, message="This method is not allowed"): |
91 | 114 | super(NotAllowedError, self).__init__(message)
|
92 | 115 |
|
| 116 | + self.response_object = response_object |
| 117 | + |
93 | 118 |
|
94 | 119 | class TooManyRequestsError(Exception):
|
95 |
| - def __init__(self, message="Too many requests. Your quota limit might be reached"): |
| 120 | + def __init__(self, response_object, message="Too many requests. Your quota limit might be reached"): |
96 | 121 | super(TooManyRequestsError, self).__init__(message)
|
97 | 122 |
|
| 123 | + self.response_object = response_object |
| 124 | + |
98 | 125 |
|
99 | 126 | class NotAcceptableError(Exception):
|
100 |
| - def __init__(self, message="This content is not acceptable"): |
| 127 | + def __init__(self, response_object, message="This content is not acceptable"): |
101 | 128 | super(NotAcceptableError, self).__init__(message)
|
102 | 129 |
|
| 130 | + self.response_object = response_object |
| 131 | + |
103 | 132 |
|
104 | 133 | class CloudDeepScanException(Exception):
|
105 | 134 | """Base exception for the clouddeepscan module
|
|
0 commit comments