summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2010-10-14 10:15:47 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2010-10-14 10:15:52 +0200
commit0de1116a4d27cfdb2a0d4e8df00f16527e1566bd (patch)
treee7838ac8c9990ad56ec6290ea718dbf3af2370b9
parente327a8c418759208a6cd0cab974737af6d1897eb (diff)
dictclient: monkeypatch DICTError
The Ruby/DICT library is so tightly coupled with the rdict client that its errors exit on initialize, instead of letting the lib user do that. This makes those errors untrappable from the code. Fix by monkeypatching DICTError to just act like the other exceptions in Ruby.
-rw-r--r--data/rbot/plugins/dictclient.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/data/rbot/plugins/dictclient.rb b/data/rbot/plugins/dictclient.rb
index d7e5091c..34276dad 100644
--- a/data/rbot/plugins/dictclient.rb
+++ b/data/rbot/plugins/dictclient.rb
@@ -17,6 +17,11 @@
# requires Ruby/DICT <http://www.caliban.org/ruby/ruby-dict.shtml>
begin
require 'dict'
+ class ::DICTError
+ def initialize(msg, code = 1)
+ super(msg)
+ end
+ end
rescue LoadError
raise LoadError, "Ruby/DICT not found, grab it from http://www.caliban.org/ruby/ruby-dict.shtml"
end