Skip to content

Commit 00198f9

Browse files
committed
make the response content of a failed api call available to an exception handler
this allows for the following code: try: vaultwarden_client.api_request(...) except httpx.HTTPStatusError as e: print(e.response.json())
1 parent 2c12bb1 commit 00198f9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/vaultwarden/utils/logger.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ def log_raise_for_status(response) -> None:
1111
)
1212
if response.status_code >= 400:
1313
logger.error(f"Error: {response.status_code}")
14+
response.read() # raise_for_status() closes stream, must read beforehand
1415
response.raise_for_status()

0 commit comments

Comments
 (0)