Skip to content

Commit

Permalink
[FIX] Fix for APIError in requests (#604)
Browse files Browse the repository at this point in the history
Fix for APIError in requests
  • Loading branch information
harini-venkataraman authored Aug 21, 2024
1 parent 4de6ab9 commit b245597
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions backend/utils/request/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import requests as pyrequests
from requests.exceptions import RequestException
from unstract.prompt_service.exceptions import APIError

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -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
3 changes: 2 additions & 1 deletion prompt-service/src/unstract/prompt_service/utils/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import requests as pyrequests
from requests.exceptions import RequestException
from unstract.prompt_service.exceptions import APIError

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -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

0 comments on commit b245597

Please sign in to comment.