diff --git a/pro_tes/exceptions.py b/pro_tes/exceptions.py index c50a868..116d895 100644 --- a/pro_tes/exceptions.py +++ b/pro_tes/exceptions.py @@ -17,16 +17,16 @@ # pylint: disable="too-few-public-methods" -class TaskNotFound(NotFound): - """Raised when task with given task identifier was not found.""" - - class IdsUnavailableProblem(PyMongoError): """Raised when task identifier is unavailable.""" -class NoTesInstancesAvailable(ValueError): - """Raised when no TES instances are available.""" +class InputUriError(ValueError): + """Raised when input URI cannot be parsed.""" + + +class IPDistanceCalculationError(ValueError): + """Raised when IP distance cannot be calculated.""" class MiddlewareException(ValueError): @@ -37,6 +37,18 @@ class InvalidMiddleware(MiddlewareException): """Raised when a middleware is invalid.""" +class NoTesInstancesAvailable(ValueError): + """Raised when no TES instances are available.""" + + +class TaskNotFound(NotFound): + """Raised when task with given task identifier was not found.""" + + +class TesUriError(ValueError): + """Raised when TES URI cannot be parsed.""" + + exceptions = { Exception: { "message": "An unexpected error occurred.", @@ -58,6 +70,14 @@ class InvalidMiddleware(MiddlewareException): "message": "The request is malformed.", "code": "400", }, + TesUriError: { + "message": "TES URI cannot be parsed", + "code": "400", + }, + InputUriError: { + "message": "Input URI cannot be parsed.", + "code": "400", + }, Unauthorized: { "message": " The request is unauthorized.", "code": "401", @@ -94,4 +114,8 @@ class InvalidMiddleware(MiddlewareException): "message": "Middleware is invalid.", "code": "500", }, + IPDistanceCalculationError: { + "message": "IP distance calculation failed.", + "code": "500", + }, }