diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2010-10-14 10:15:47 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2010-10-14 10:15:52 +0200 |
commit | 0de1116a4d27cfdb2a0d4e8df00f16527e1566bd (patch) | |
tree | e7838ac8c9990ad56ec6290ea718dbf3af2370b9 /data/rbot/plugins/dictclient.rb | |
parent | e327a8c418759208a6cd0cab974737af6d1897eb (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.
Diffstat (limited to 'data/rbot/plugins/dictclient.rb')
-rw-r--r-- | data/rbot/plugins/dictclient.rb | 5 |
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 |