Handle errors when there was no json response
This commit is contained in:
parent
f1ce9fb455
commit
69c0703e17
@ -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))
|
||||||
|
Loading…
Reference in New Issue
Block a user