summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-09-11 11:22:40 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-09-11 11:22:40 +0000
commit06185978eaf9d0eaef5089afb97ae8ca521a41b1 (patch)
tree24e3de82de55f2e5eddc77eeeae8f6a63ca02b9f /data
parent06ab3351b8b6bdc8628244959b03751acd61e2fa (diff)
translator plugin: catch all exceptions when trying to initialize translators
The most significant exception that wasn't catched was LoadError, so that a failing require 'mechanize' would cause the whole plugin from failing to load, instead of just disabling the translators depending on WWW::Mechanize
Diffstat (limited to 'data')
-rw-r--r--data/rbot/plugins/translator.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/data/rbot/plugins/translator.rb b/data/rbot/plugins/translator.rb
index 65348d0f..c2b74eeb 100644
--- a/data/rbot/plugins/translator.rb
+++ b/data/rbot/plugins/translator.rb
@@ -209,7 +209,7 @@ class BabelfishTranslator < Translator
def initialize(cache)
require 'mechanize'
-
+
@form = WWW::Mechanize.new.get('http://babelfish.altavista.com/babelfish/').
forms.name('frmTrText').first
@lang_list = @form.fields.name('lp')
@@ -272,7 +272,7 @@ class TranslatorPlugin < Plugin
begin
@translators[name] = c.new(@registry.sub_registry(name))
map "#{name} :from :to *phrase", :action => :cmd_translate
- rescue
+ rescue Exception
warning _("Translator %{name} cannot be used: %{reason}") %
{:name => name, :reason => $!}
end