fix: Print HTTP response body on errors.

This commit is contained in:
Elisiário Couto
2024-03-06 18:32:14 +00:00
parent 4f2daa7953
commit ee30bff5ef
2 changed files with 5 additions and 6 deletions

View File

@@ -119,5 +119,5 @@ def sync(ctx: click.Context):
for account in accounts:
try:
save_transactions(ctx, account)
except Exception as e:
error(f"[{account}] Error: Sync failed, skipping account. Exception: {e}")
except Exception:
error(f"[{account}] Error: Sync failed, skipping account.")

View File

@@ -14,7 +14,7 @@ def get(ctx: click.Context, path: str, params: dict = {}):
try:
res.raise_for_status()
except Exception as e:
error(f"Error: {e}")
error(f"Error: {e}\n{res.text}")
ctx.abort()
return res.json()
@@ -29,7 +29,7 @@ def post(ctx: click.Context, path: str, data: dict = {}):
try:
res.raise_for_status()
except Exception as e:
error(f"Error: {e}")
error(f"Error: {e}\n{res.text}")
ctx.abort()
return res.json()
@@ -44,7 +44,6 @@ def put(ctx: click.Context, path: str, data: dict = {}):
try:
res.raise_for_status()
except Exception as e:
error(f"Error: {e}")
error(res.text)
error(f"Error: {e}\n{res.text}")
ctx.abort()
return res.json()