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 _:
print(Panel(data["message"],
title=f"[bold red]Error: {response.status_code}",
expand=False))
if "message" in data:
print(Panel(data["message"],
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))