summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-05-20 22:30:55 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-05-20 22:30:55 +0000
commitb035320d69d2144765645b9f3143101b003e547d (patch)
tree73739e19c253bfd83ba9c2a01fb03688850bd766
parentb2bdb83bfcd123df4e8e0effa83b989a00d8ddce (diff)
Raise with a meaningful error message when block/unblock/rescehdule is attempted on a nonexistant timer.
-rw-r--r--lib/rbot/timer.rb3
1 files changed, 3 insertions, 0 deletions
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