| jerith ( |
irb(main):002:0> begin
irb(main):003:1* raise Timeout::Error.new()
irb(main):004:1> rescue
irb(main):005:1> puts "foo"
irb(main):006:1> end
(irb):3:in `irb_binding': Timeout::Error (Timeout::Error)
from /usr/lib/ruby/1.8/irb/workspace.rb:52:in `irb_binding'
from /usr/lib/ruby/1.8/irb/workspace.rb:52
[jerith@jerith-lap1 ~]$ Andirb(main):002:0> raise Timeout::Error.new rescue ""
(irb):2:in `irb_binding': Timeout::Error (Timeout::Error)
from /usr/lib/ruby/1.8/irb/workspace.rb:52:in `irb_binding'
from /usr/lib/ruby/1.8/irb/workspace.rb:52So yes, it is broken in that case. You need to explicitly rescue Exception (which is a horrifically bad idea) or Timeout::Error, in addition to all your other exceptions.The other problem is that this isn't made apparent anywhere until you get dumped out of an irb session or your supposedly bulletproof app falls over. I wonder how much production code out there suffers from this? I know the stock XML-RPC library does, because that's where I encountered it in the first place, at the cost of about half an hour's work. (I ended up not redoing it anyway, because power went away and the network was flakey, but that's a different rant entirely.)