(hopefully) properly catch/log URLError, IndexError
This commit is contained in:
parent
a45af7a0a7
commit
ebd89d35cc
@ -20,6 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
from extlib import irclib
|
||||
from extlib import pywapi
|
||||
|
||||
from urllib2 import URLError
|
||||
|
||||
from Module import Module
|
||||
|
||||
class Weather(Module):
|
||||
@ -38,9 +40,10 @@ class Weather(Module):
|
||||
weatherstr += " " + city['day_of_week'].encode('utf-8') + ": " + city['condition'].encode('utf-8') + ". High " + city['high'].encode('utf-8') + "°F, Low " + city['low'].encode('utf-8') + "°F."
|
||||
|
||||
return self.reply(connection, replypath, unicode(weatherstr, 'utf-8'))
|
||||
except URLError as e:
|
||||
return self.reply(connection, replypath, "error connecting to google weather:" + str(e))
|
||||
except IndexError as e:
|
||||
print("error in pywapi: " + str(e))
|
||||
return
|
||||
return self.reply(connection, replypath, "error in pywapi: " + str(e))
|
||||
|
||||
# vi:tabstop=4:expandtab:autoindent
|
||||
# kate: indent-mode python;indent-width 4;replace-tabs on;
|
||||
|
Loading…
Reference in New Issue
Block a user