Skip to content

Commit 4b2ad72

Browse files
authored
Fix exception causes in async_client.py
1 parent be8bfb5 commit 4b2ad72

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/mistralai/async_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,15 +201,15 @@ async def _request(
201201

202202
try:
203203
json_response: Dict[str, Any] = await response.json()
204-
except JSONDecodeError:
204+
except JSONDecodeError as e:
205205
raise MistralAPIException.from_aio_response(
206206
response, message=f"Failed to decode json body: {await response.text()}"
207-
)
207+
) from e
208208
except aiohttp.ClientPayloadError as e:
209209
raise MistralAPIException.from_aio_response(
210210
response,
211211
message=f"An unexpected error occurred while receiving the response: {e}",
212-
)
212+
) from e
213213

214214
self._logger.debug(f"JSON response: {json_response}")
215215
self._check_response(json_response, dict(response.headers), response.status)

0 commit comments

Comments
 (0)