diff --git a/openweather.py b/openweather.py index ec2c976..1dfdf31 100755 --- a/openweather.py +++ b/openweather.py @@ -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))