From b2455973d21fd22095c75f2c9f849cd45cba1644 Mon Sep 17 00:00:00 2001 From: harini-venkataraman <115449948+harini-venkataraman@users.noreply.github.com> Date: Wed, 21 Aug 2024 15:13:20 +0530 Subject: [PATCH] [FIX] Fix for APIError in requests (#604) Fix for APIError in requests --- backend/utils/request/request.py | 3 +-- prompt-service/src/unstract/prompt_service/utils/request.py | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/utils/request/request.py b/backend/utils/request/request.py index c7006af38..be802af96 100644 --- a/backend/utils/request/request.py +++ b/backend/utils/request/request.py @@ -4,7 +4,6 @@ import requests as pyrequests from requests.exceptions import RequestException -from unstract.prompt_service.exceptions import APIError logger = logging.getLogger(__name__) @@ -44,7 +43,7 @@ def make_http_request( return return_val except RequestException as e: logger.error(f"HTTP request error: {e}") - raise APIError(f"Error occured while invoking POST API Variable : {str(e)}") + raise e except Exception as e: logger.error(f"An unexpected error occurred: {e}") raise e diff --git a/prompt-service/src/unstract/prompt_service/utils/request.py b/prompt-service/src/unstract/prompt_service/utils/request.py index be802af96..c7006af38 100644 --- a/prompt-service/src/unstract/prompt_service/utils/request.py +++ b/prompt-service/src/unstract/prompt_service/utils/request.py @@ -4,6 +4,7 @@ import requests as pyrequests from requests.exceptions import RequestException +from unstract.prompt_service.exceptions import APIError logger = logging.getLogger(__name__) @@ -43,7 +44,7 @@ def make_http_request( return return_val except RequestException as e: logger.error(f"HTTP request error: {e}") - raise e + raise APIError(f"Error occured while invoking POST API Variable : {str(e)}") except Exception as e: logger.error(f"An unexpected error occurred: {e}") raise e