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