|
2 | 2 |
|
3 | 3 |
|
4 | 4 | class FunctionBaseError(OsparcErrorMixin, Exception): |
5 | | - pass |
| 5 | + status_code: int |
6 | 6 |
|
7 | 7 |
|
8 | 8 | class FunctionJobReadAccessDeniedError(FunctionBaseError): |
9 | 9 | msg_template: str = ( |
10 | 10 | "Function job {function_job_id} read access denied for user {user_id}" |
11 | 11 | ) |
| 12 | + status_code: int = 403 # Forbidden |
12 | 13 |
|
13 | 14 |
|
14 | 15 | class FunctionIDNotFoundError(FunctionBaseError): |
15 | 16 | msg_template: str = "Function {function_id} not found" |
| 17 | + status_code: int = 404 # Not Found |
16 | 18 |
|
17 | 19 |
|
18 | 20 | class FunctionJobIDNotFoundError(FunctionBaseError): |
19 | 21 | msg_template: str = "Function job {function_job_id} not found" |
| 22 | + status_code: int = 404 # Not Found |
20 | 23 |
|
21 | 24 |
|
22 | 25 | class FunctionInputsValidationError(FunctionBaseError): |
23 | 26 | msg_template: str = "Function inputs validation failed: {error}" |
| 27 | + status_code: int = 422 # Unprocessable Entity |
24 | 28 |
|
25 | 29 |
|
26 | 30 | class FunctionReadAccessDeniedError(FunctionBaseError): |
27 | 31 | msg_template: str = "Function {function_id} read access denied for user {user_id}" |
| 32 | + status_code: int = 403 # Forbidden |
28 | 33 |
|
29 | 34 |
|
30 | 35 | class FunctionJobCollectionIDNotFoundError(FunctionBaseError): |
31 | 36 | msg_template: str = "Function job collection {function_job_collection_id} not found" |
| 37 | + status_code: int = 404 # Not Found |
32 | 38 |
|
33 | 39 |
|
34 | 40 | class UnsupportedFunctionClassError(FunctionBaseError): |
35 | 41 | msg_template: str = "Function class {function_class} is not supported" |
| 42 | + status_code: int = 400 # Bad Request |
36 | 43 |
|
37 | 44 |
|
38 | 45 | class UnsupportedFunctionJobClassError(FunctionBaseError): |
39 | 46 | msg_template: str = "Function job class {function_job_class} is not supported" |
| 47 | + status_code: int = 400 # Bad Request |
40 | 48 |
|
41 | 49 |
|
42 | 50 | class UnsupportedFunctionFunctionJobClassCombinationError(FunctionBaseError): |
43 | 51 | msg_template: str = ( |
44 | 52 | "Function class {function_class} and function job class {function_job_class} combination is not supported" |
45 | 53 | ) |
| 54 | + status_code: int = 400 # Bad Request |
46 | 55 |
|
47 | 56 |
|
48 | 57 | class FunctionJobCollectionReadAccessDeniedError(FunctionBaseError): |
49 | 58 | msg_template: str = ( |
50 | 59 | "Function job collection {function_job_collection_id} read access denied for user {user_id}" |
51 | 60 | ) |
| 61 | + status_code: int = 403 # Forbidden |
52 | 62 |
|
53 | 63 |
|
54 | 64 | class FunctionWriteAccessDeniedError(FunctionBaseError): |
55 | 65 | msg_template: str = "Function {function_id} write access denied for user {user_id}" |
| 66 | + status_code: int = 403 # Forbidden |
56 | 67 |
|
57 | 68 |
|
58 | 69 | class FunctionJobWriteAccessDeniedError(FunctionBaseError): |
59 | 70 | msg_template: str = ( |
60 | 71 | "Function job {function_job_id} write access denied for user {user_id}" |
61 | 72 | ) |
| 73 | + status_code: int = 403 # Forbidden |
62 | 74 |
|
63 | 75 |
|
64 | 76 | class FunctionJobCollectionWriteAccessDeniedError(FunctionBaseError): |
65 | 77 | msg_template: str = ( |
66 | 78 | "Function job collection {function_job_collection_id} write access denied for user {user_id}" |
67 | 79 | ) |
| 80 | + status_code: int = 403 # Forbidden |
68 | 81 |
|
69 | 82 |
|
70 | 83 | class FunctionExecuteAccessDeniedError(FunctionBaseError): |
71 | 84 | msg_template: str = ( |
72 | 85 | "Function {function_id} execute access denied for user {user_id}" |
73 | 86 | ) |
| 87 | + status_code: int = 403 # Forbidden |
74 | 88 |
|
75 | 89 |
|
76 | 90 | class FunctionJobExecuteAccessDeniedError(FunctionBaseError): |
77 | 91 | msg_template: str = ( |
78 | 92 | "Function job {function_job_id} execute access denied for user {user_id}" |
79 | 93 | ) |
| 94 | + status_code: int = 403 # Forbidden |
80 | 95 |
|
81 | 96 |
|
82 | 97 | class FunctionJobCollectionExecuteAccessDeniedError(FunctionBaseError): |
83 | 98 | msg_template: str = ( |
84 | 99 | "Function job collection {function_job_collection_id} execute access denied for user {user_id}" |
85 | 100 | ) |
| 101 | + status_code: int = 403 # Forbidden |
0 commit comments