-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathexceptions.py
More file actions
67 lines (47 loc) · 1.93 KB
/
Copy pathexceptions.py
File metadata and controls
67 lines (47 loc) · 1.93 KB
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
class ApiError(Exception):
status_code = 500
class MissingRecordError(ApiError):
def __init__(self, msg="No such record in table", *args, **kwargs):
super().__init__(msg, *args, **kwargs)
self.status_code = 404
class FilterError(ApiError):
def __init__(self, msg="Invalid filter requested", *args, **kwargs):
super().__init__(msg, *args, **kwargs)
self.status_code = 400
class MultipleIncludeError(FilterError):
def __init__(
self,
msg="Bad request, only one include filter may be given per request",
*args,
**kwargs,
):
super().__init__(msg, *args, **kwargs)
self.status_code = 400
class AuthenticationError(ApiError):
def __init__(self, msg="Authentication error", *args, **kwargs):
super().__init__(msg, *args, **kwargs)
self.status_code = 403
class MissingCredentialsError(AuthenticationError):
def __init__(self, msg="No credentials provided in auth header", *args, **kwargs):
super().__init__(msg, *args, **kwargs)
self.status_code = 401
class BadRequestError(ApiError):
def __init__(self, msg="Bad request", *args, **kwargs):
super().__init__(msg, *args, **kwargs)
self.status_code = 400
class DatabaseError(ApiError):
def __init__(self, msg="Database error", *args, **kwargs):
super().__init__(msg, *args, **kwargs)
self.status_code = 500
class PythonICATError(ApiError):
def __init__(self, msg="Python ICAT error", *args, **kwargs):
super().__init__(msg, *args, **kwargs)
self.status_code = 500
class SearchAPIError(ApiError):
def __init__(self, msg="Search API error", *args, **kwargs):
super().__init__(msg, *args, **kwargs)
self.status_code = 500
class ScoringAPIError(ApiError):
def __init__(self, msg="Scoring API error", *args, **kwargs):
super().__init__(msg, *args, **kwargs)
self.status_code = 500