From a8ebadc82e38758879be172ca5af3ac48c76f5f5 Mon Sep 17 00:00:00 2001 From: James Lu Date: Thu, 9 Mar 2017 18:46:07 -0800 Subject: [PATCH] Weather: show a proper error if current conditions couldn't be found --- Weather/plugin.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Weather/plugin.py b/Weather/plugin.py index 2826949..062e27e 100644 --- a/Weather/plugin.py +++ b/Weather/plugin.py @@ -418,6 +418,9 @@ class Weather(callbacks.Plugin): self.log.error("Weather: Error processing JSON from: {0} :: {1}".format(url, e)) irc.error("Could not process JSON from Weather Underground. Check the logs.", Raise=True) + if 'current_observation' not in data: + irc.error("Failed to fetch current conditions for %r." % loc, Raise=True) + outdata = {'weather': data['current_observation']['weather'], 'location': data['current_observation']['display_location']['full'], 'humidity': data['current_observation']['relative_humidity'],