Skip to content

Commit c2011c0

Browse files
uedvt359Lujeni
authored andcommitted
fix(logger): 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 ea6dc57 commit c2011c0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/vaultwarden/utils/logger.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ def log_raise_for_status(response) -> None:
1111
)
1212
if response.status_code >= 400:
1313
logger.error(f"Error: {response.status_code}")
14+
# raise_for_status() closes stream, must read the response before that:
15+
response.read()
1416
response.raise_for_status()

0 commit comments

Comments
 (0)