Skip to content

Commit

Permalink
Merge pull request #23 from halorgium/interests-in-exception
Browse files Browse the repository at this point in the history
Add the existing monitor interests to the exception
  • Loading branch information
tarcieri committed Apr 19, 2013
2 parents 7421c06 + e369603 commit 7aa8133
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/nio/selector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7aa8133

Please sign in to comment.