From e36960345d1a305e20ea8e8c5ebfb12d0f4bb6f3 Mon Sep 17 00:00:00 2001 From: Tim Carey-Smith Date: Fri, 19 Apr 2013 23:21:27 +1200 Subject: [PATCH] Add the existing monitor interests to the exception --- lib/nio/selector.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/nio/selector.rb b/lib/nio/selector.rb index 0dfb647..2272dba 100644 --- a/lib/nio/selector.rb +++ b/lib/nio/selector.rb @@ -18,7 +18,9 @@ def initialize # * :rw - is the IO either readable or writeable? def register(io, interest) @lock.synchronize do - raise ArgumentError, "this IO is already registered with the selector" if @selectables[io] + if monitor = @selectables[io] + raise ArgumentError, "this IO is already registered with the selector as #{monitor.interests.inspect}" + end monitor = Monitor.new(io, interest, self) @selectables[io] = monitor