From b6c2e6d50b7370f06758e42148b643001b5253cf Mon Sep 17 00:00:00 2001 From: Nidhi091999 Date: Sat, 22 Feb 2025 18:18:44 +0530 Subject: [PATCH 1/2] 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", + }, } From 4d4f7950cfb9e8cef3fb4664d2459eb1d01c1cee Mon Sep 17 00:00:00 2001 From: Nidhi091999 Date: Sat, 3 May 2025 17:40:50 +0530 Subject: [PATCH 2/2] fix lint issues --- pro_tes/exceptions.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pro_tes/exceptions.py b/pro_tes/exceptions.py index 39cabda..8ba0030 100644 --- a/pro_tes/exceptions.py +++ b/pro_tes/exceptions.py @@ -32,12 +32,15 @@ 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.""" @@ -45,6 +48,7 @@ class InputUriError(ValueError): class IPDistanceCalculationError(ValueError): """Raised when IP distance cannot be calculated.""" + exceptions = { Exception: { "message": "An unexpected error occurred.", @@ -110,7 +114,7 @@ class IPDistanceCalculationError(ValueError): "message": "IP distance calculation failed.", "code": "500", }, - TesUriError: { + TesUriError: { "message": "TES URI cannot be parsed", "code": "400", },