From b6c2e6d50b7370f06758e42148b643001b5253cf Mon Sep 17 00:00:00 2001 From: Nidhi091999 Date: Sat, 22 Feb 2025 18:18:44 +0530 Subject: [PATCH] Added InputUriError and IPDistanceCalculationError --- pro_tes/exceptions.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pro_tes/exceptions.py b/pro_tes/exceptions.py index c50a868..39cabda 100644 --- a/pro_tes/exceptions.py +++ b/pro_tes/exceptions.py @@ -32,10 +32,18 @@ class NoTesInstancesAvailable(ValueError): class MiddlewareException(ValueError): """Raised when a middleware could not be applied.""" +class TesUriError(ValueError): + """Raised when TES URI cannot be parsed.""" class InvalidMiddleware(MiddlewareException): """Raised when a middleware is invalid.""" +class InputUriError(ValueError): + """Raised when input URI cannot be parsed.""" + + +class IPDistanceCalculationError(ValueError): + """Raised when IP distance cannot be calculated.""" exceptions = { Exception: { @@ -94,4 +102,16 @@ class InvalidMiddleware(MiddlewareException): "message": "Middleware is invalid.", "code": "500", }, + InputUriError: { + "message": "Input URI cannot be parsed.", + "code": "400", + }, + IPDistanceCalculationError: { + "message": "IP distance calculation failed.", + "code": "500", + }, + TesUriError: { + "message": "TES URI cannot be parsed", + "code": "400", + }, }