mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-04-26 13:01:07 -05:00
Weather: show a proper error if current conditions couldn't be found
This commit is contained in:
parent
364f2d4f6a
commit
a8ebadc82e
@ -418,6 +418,9 @@ class Weather(callbacks.Plugin):
|
|||||||
self.log.error("Weather: Error processing JSON from: {0} :: {1}".format(url, e))
|
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)
|
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'],
|
outdata = {'weather': data['current_observation']['weather'],
|
||||||
'location': data['current_observation']['display_location']['full'],
|
'location': data['current_observation']['display_location']['full'],
|
||||||
'humidity': data['current_observation']['relative_humidity'],
|
'humidity': data['current_observation']['relative_humidity'],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user