From ea631e1b17c124dc6a990df13414c51e6e0610b6 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Tue, 24 Aug 2010 19:43:14 +0200 Subject: [PATCH] hangman plugin: don't fail silently on !hangman If the random generation site failed for any reason (eg. by returning a non-2xx page), starting a hangman game would fail silently. Catch this case and announce the failure. --- data/rbot/plugins/games/hangman.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/data/rbot/plugins/games/hangman.rb b/data/rbot/plugins/games/hangman.rb index 7cfd9e69..612b8350 100644 --- a/data/rbot/plugins/games/hangman.rb +++ b/data/rbot/plugins/games/hangman.rb @@ -16,6 +16,7 @@ module RandomWord def self.get(count=1) res = Net::HTTP.post_form(URI.parse(SITE), {'numwords' => count}) + raise _("random word generator site failed with #{res.code} - #{res.message}") unless Net::HTTPSuccess === res words = res.body.scan(%r{