From: Brian Candler Date: 2008-11-14T17:27:42+09:00 Subject: Re: Unable to rescue Errno::ECONNRESET during What's interesting is that line 929 of net/imap.rb is in the backtrace: def receive_responses while true begin resp = get_response # line 929 rescue Exception @sock.close @client_thread.raise($!) break end It looks like the exception should be caught here, and explicitly re-raised in another thread from line 932. You could try adding some STDERR debugging before and after the get_response line, and inside the rescue Exception clause. Maybe "@sock.close" should be "@sock.close rescue nil" in case another exception is raised then. But line 931 isn't in the backtrace. Raising and catching the exception in another thread ought to work as far as I can see: class Foo def initialize t = Thread.current Thread.start do t.raise Errno::ECONNRESET end.join end end begin f = Foo.new rescue Errno::ECONNRESET puts "Caught it: #{$!.backtrace.join("\n")}" end -- Posted via http://www.ruby-forum.com/.