Coverage for webapp/api/exceptions.py: 88%
16 statements
« prev ^ index » next coverage.py v7.8.0, created at 2025-04-28 22:05 +0000
« prev ^ index » next coverage.py v7.8.0, created at 2025-04-28 22:05 +0000
1class ApiError(Exception):
2 """
3 Base exception for any errors in the API layer
4 """
6 pass
9class ApiConnectionError(ApiError):
10 """
11 Communication with the API failed
12 """
14 pass
17class ApiTimeoutError(ApiError):
18 """
19 Communication with the API timed out
20 """
22 pass
25class ApiResponseDecodeError(ApiError):
26 """
27 We failed to properly decode the response from the API
28 """
30 pass
33class ApiResponseError(ApiError):
34 """
35 The API responded with an error
36 """
38 def __init__(self, message, status_code):
39 self.status_code = status_code
40 return super().__init__(message)
43class ApiResponseErrorList(ApiResponseError):
44 """
45 The API responded with a list of errors,
46 which are included in self.errors
47 """
49 def __init__(self, message, status_code, errors):
50 self.errors = errors
51 return super().__init__(message, status_code)