]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
Raise with a meaningful error message when block/unblock/rescehdule is attempted...
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sun, 20 May 2007 22:30:55 +0000 (22:30 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sun, 20 May 2007 22:30:55 +0000 (22:30 +0000)
lib/rbot/timer.rb

index c87c9c4db80aad98b1b123a0f19e028950b8592c..db0c6ea16bee0d89aefd0104832347551fee997c 100644 (file)
@@ -117,16 +117,19 @@ module Timer
 
     # block action with handle +handle+
     def block(handle)
+      raise "no such timer #{handle}" unless @timers[handle]
       @timers[handle].blocked = true
     end
 
     # unblock action with handle +handle+
     def unblock(handle)
+      raise "no such timer #{handle}" unless @timers[handle]
       @timers[handle].blocked = false
     end
 
     # reschedule action with handle +handle+ to change its period
     def reschedule(handle, period)
+      raise "no such timer #{handle}" unless @timers[handle]
       @timers[handle].reschedule(period)
     end