From b035320d69d2144765645b9f3143101b003e547d Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 20 May 2007 22:30:55 +0000 Subject: [PATCH] Raise with a meaningful error message when block/unblock/rescehdule is attempted on a nonexistant timer. --- lib/rbot/timer.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/rbot/timer.rb b/lib/rbot/timer.rb index c87c9c4d..db0c6ea1 100644 --- a/lib/rbot/timer.rb +++ b/lib/rbot/timer.rb @@ -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 -- 2.39.5