From 0de1116a4d27cfdb2a0d4e8df00f16527e1566bd Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 14 Oct 2010 10:15:47 +0200 Subject: 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. --- data/rbot/plugins/dictclient.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'data/rbot/plugins/dictclient.rb') 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 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 -- cgit v1.2.3