]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
Fix timer handling when Actions raise errors
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 20 Feb 2007 08:15:59 +0000 (08:15 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 20 Feb 2007 08:15:59 +0000 (08:15 +0000)
ChangeLog
lib/rbot/timer.rb

index b82b3b0f685b3dc2b9b4176891c2ef1597d04694..2aea6f0e7a816076ee6e6acae36d65f5254a0d64 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-02-20  Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
+
+       * Timers: failing timer actions don't prevent the global timer ticker
+       from functioning properly.
+
 2007-02-18  Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
 
        * Plugin: Provide a plugin.header file with boilerplate plugin
index 5d52717956306565ac60c3f9a086be297912559d..181dd2db92137df90098be067787dfaf0eb6d770 100644 (file)
@@ -45,10 +45,16 @@ module Timer
       # really short duration timers can overrun and leave @in negative,
       # for these we set @in to @period
       @in = @period if @in <= 0
-      if(@data)
-        @func.call(@data)
-      else
-        @func.call
+      begin
+        if(@data)
+          @func.call(@data)
+        else
+          @func.call
+        end
+      rescue => e
+        error "Timer action #{self.inspect} with function #{@func.inspect} failed with error #{e.inspect}"
+        error e.backtrace.join("\n")
+        # TODO maybe we want to block this Action?
       end
       return @once
     end