Skip to content

Commit

Permalink
Merge 3c3f5d6 into c2a6cf6
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas2D committed Nov 14, 2023
2 parents c2a6cf6 + 3c3f5d6 commit ee8db27
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/genai/exceptions/genai_exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, error: Union[Exception, Response, str, ErrorResponse]) -> Non
elif isinstance(error, Response):
try:
self.error = ErrorResponse(**error.json())
self.error_message = self.error.message
self.error_message = self.error.model_dump_json()
except ValidationError:
self.error = error
self.error_message = str(error.content)
Expand Down
2 changes: 1 addition & 1 deletion src/genai/services/async_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ async def _get_response_json(self, model, inputs, params, options):
response_raw = await self._service_fn(model, inputs, params, options)
response = response_raw.json()
if response_raw and not response_raw.is_success:
raise Exception(response)
raise GenAiException(response)
except Exception as ex:
logger.error("Error in _get_response_json {}: {}".format(type(ex), str(ex)))
if self.throw_on_error:
Expand Down
2 changes: 1 addition & 1 deletion src/genai/utils/http_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async def handle_async_request(

if ex.response and "application/json" in ex.response.headers["Content-Type"]:
await ex.response.aread()
raise GenAiException(ex.response)
raise GenAiException(ex.response) from None
else:
raise ex

Expand Down

0 comments on commit ee8db27

Please sign in to comment.