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