diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-03-07 11:21:10 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-03-07 11:21:10 +0100 |
commit | a1bb375a1972dcf33a4c391852504e7bdb27889f (patch) | |
tree | cf45b2fe5f94a6d6284bc0cf6aede2c9130a5d08 /data/rbot | |
parent | b46397e1cf9698942c2a85cec42e9185cfb1bf29 (diff) |
lastfm: handle network errors when looking for events by venue
Diffstat (limited to 'data/rbot')
-rw-r--r-- | data/rbot/plugins/lastfm.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/data/rbot/plugins/lastfm.rb b/data/rbot/plugins/lastfm.rb index 9559f764..6e899c1a 100644 --- a/data/rbot/plugins/lastfm.rb +++ b/data/rbot/plugins/lastfm.rb @@ -192,7 +192,16 @@ class LastFmPlugin < Plugin uri = "#{APIURL}method=geo.getevents&location=#{CGI.escape location.to_s}" emptymsg = _("no events found in %{location}") % {:location => location.to_s} elsif venue - venues = search_venue_by(:name => venue.to_s, :limit => 1) + begin + venues = search_venue_by(:name => venue.to_s, :limit => 1) + rescue Exception => e + error e + m.reply _("an error occurred looking for venue %{venue}: %{e}") % { + :venue => venue.to_s, + :e => e.message + } + end + if venues.empty? m.reply _("no venue found matching %{venue}") % {:venue => venue.to_s} return |