Skip to content

Commit 156c558

Browse files
Nidhi091999uniqueg
andauthored
fix: readd lost custom errors (#182)
Co-authored-by: Alex Kanitz <alexander.kanitz@unibas.ch>
1 parent f83c3e3 commit 156c558

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

pro_tes/exceptions.py

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717
# pylint: disable="too-few-public-methods"
1818

1919

20-
class TaskNotFound(NotFound):
21-
"""Raised when task with given task identifier was not found."""
22-
23-
2420
class IdsUnavailableProblem(PyMongoError):
2521
"""Raised when task identifier is unavailable."""
2622

2723

28-
class NoTesInstancesAvailable(ValueError):
29-
"""Raised when no TES instances are available."""
24+
class InputUriError(ValueError):
25+
"""Raised when input URI cannot be parsed."""
26+
27+
28+
class IPDistanceCalculationError(ValueError):
29+
"""Raised when IP distance cannot be calculated."""
3030

3131

3232
class MiddlewareException(ValueError):
@@ -37,6 +37,18 @@ class InvalidMiddleware(MiddlewareException):
3737
"""Raised when a middleware is invalid."""
3838

3939

40+
class NoTesInstancesAvailable(ValueError):
41+
"""Raised when no TES instances are available."""
42+
43+
44+
class TaskNotFound(NotFound):
45+
"""Raised when task with given task identifier was not found."""
46+
47+
48+
class TesUriError(ValueError):
49+
"""Raised when TES URI cannot be parsed."""
50+
51+
4052
exceptions = {
4153
Exception: {
4254
"message": "An unexpected error occurred.",
@@ -58,6 +70,14 @@ class InvalidMiddleware(MiddlewareException):
5870
"message": "The request is malformed.",
5971
"code": "400",
6072
},
73+
TesUriError: {
74+
"message": "TES URI cannot be parsed",
75+
"code": "400",
76+
},
77+
InputUriError: {
78+
"message": "Input URI cannot be parsed.",
79+
"code": "400",
80+
},
6181
Unauthorized: {
6282
"message": " The request is unauthorized.",
6383
"code": "401",
@@ -94,4 +114,8 @@ class InvalidMiddleware(MiddlewareException):
94114
"message": "Middleware is invalid.",
95115
"code": "500",
96116
},
117+
IPDistanceCalculationError: {
118+
"message": "IP distance calculation failed.",
119+
"code": "500",
120+
},
97121
}

0 commit comments

Comments
 (0)