From: Giuseppe Bilotta Date: Sun, 20 May 2007 22:30:55 +0000 (+0000) Subject: Raise with a meaningful error message when block/unblock/rescehdule is attempted... X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=b035320d69d2144765645b9f3143101b003e547d;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git Raise with a meaningful error message when block/unblock/rescehdule is attempted on a nonexistant timer. --- 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