From a1bb375a1972dcf33a4c391852504e7bdb27889f Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sat, 7 Mar 2009 11:21:10 +0100 Subject: [PATCH] lastfm: handle network errors when looking for events by venue --- data/rbot/plugins/lastfm.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 -- 2.32.0.93.g670b81a890