From 157c81d67d2252ab1650d7acf5c3daf067d4356a Mon Sep 17 00:00:00 2001 From: dmitry kim Date: Wed, 12 Mar 2008 02:26:47 +0300 Subject: * (messagemapper) catch and report all exceptions in threaded actions --- lib/rbot/messagemapper.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/rbot/messagemapper.rb b/lib/rbot/messagemapper.rb index 62543f32..87bdd01f 100644 --- a/lib/rbot/messagemapper.rb +++ b/lib/rbot/messagemapper.rb @@ -193,7 +193,14 @@ class Bot if m.bot.auth.allow?(auth, m.source, m.replyto) debug "template match found and auth'd: #{action.inspect} #{options.inspect}" if tmpl.options[:thread] || tmpl.options[:threaded] - Thread.new { @parent.send(action, m, options) } + Thread.new do + begin + @parent.send(action, m, options) + rescue Exception => e + error "In threaded action: #{e.message}" + debug e.backtrace.join("\n") + end + end else @parent.send(action, m, options) end -- cgit v1.2.3