]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - lib/rbot/timer.rb
Fix timer handling when Actions raise errors
[user/henk/code/ruby/rbot.git] / lib / rbot / timer.rb
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