Handle errors when there was no json response

This commit is contained in:
Marius Alwan Meyer 2023-09-29 13:41:35 +02:00
parent f1ce9fb455
commit 69c0703e17

View File

@ -40,6 +40,11 @@ match response.status_code:
])) ]))
case _: case _:
print(Panel(data["message"], if "message" in data:
title=f"[bold red]Error: {response.status_code}", print(Panel(data["message"],
expand=False)) title=f"[bold red]Error: {response.status_code}",
expand=False))
else:
print(Panel("unknown error",
title=f"[bold red]Error: {response.status_code}",
expand=False))