|
4 | 4 | class BaseLongRunningError(OsparcErrorMixin, Exception): |
5 | 5 | """base exception for this module""" |
6 | 6 |
|
7 | | - code: str = "long_running_task.base_long_running_error" # type: ignore[assignment] |
8 | | - |
9 | 7 |
|
10 | 8 | class TaskAlreadyRunningError(BaseLongRunningError): |
11 | | - code: str = "long_running_task.task_already_running" |
12 | 9 | msg_template: str = "{task_name} must be unique, found: '{managed_task}'" |
13 | 10 |
|
14 | 11 |
|
15 | 12 | class TaskNotFoundError(BaseLongRunningError): |
16 | | - code: str = "long_running_task.task_not_found" |
17 | 13 | msg_template: str = "No task with {task_id} found" |
18 | 14 |
|
19 | 15 |
|
20 | 16 | class TaskNotCompletedError(BaseLongRunningError): |
21 | | - code: str = "long_running_task.task_not_completed" |
22 | 17 | msg_template: str = "Task {task_id} has not finished yet" |
23 | 18 |
|
24 | 19 |
|
25 | 20 | class TaskCancelledError(BaseLongRunningError): |
26 | | - code: str = "long_running_task.task_cancelled_error" |
27 | 21 | msg_template: str = "Task {task_id} was cancelled before completing" |
28 | 22 |
|
29 | 23 |
|
30 | 24 | class TaskExceptionError(BaseLongRunningError): |
31 | | - code: str = "long_running_task.task_exception_error" |
32 | 25 | msg_template: str = ( |
33 | 26 | "Task {task_id} finished with exception: '{exception}'\n{traceback}" |
34 | 27 | ) |
35 | 28 |
|
36 | 29 |
|
37 | 30 | class TaskClientTimeoutError(BaseLongRunningError): |
38 | | - code: str = "long_running_task.client.timed_out_waiting_for_response" |
39 | 31 | msg_template: str = ( |
40 | 32 | "Timed out after {timeout} seconds while awaiting '{task_id}' to complete" |
41 | 33 | ) |
42 | 34 |
|
43 | 35 |
|
44 | 36 | class GenericClientError(BaseLongRunningError): |
45 | | - code: str = "long_running_task.client.generic_error" |
46 | 37 | msg_template: str = ( |
47 | 38 | "Unexpected error while '{action}' for '{task_id}': status={status} body={body}" |
48 | 39 | ) |
0 commit comments