From: Russell Fulton Date: 2006-01-24T12:56:19+09:00 Subject: Net::imap exceptions Hi, I have a program that I am using to do password auditing on various IMAP servers. It defines this method: def tryIMAP (host, usessl, user, pass) proto = usessl ? "IMAPS" : "IMAP" begin imap = Net::IMAP.new(host, usessl ? 993 : 143, usessl) rescue => e imap.disconnect if imap STDERR.print "#{host} #{proto} #{e.to_s}\n"; raise RuntimeError, "#{proto} failed" end begin imap.login( user, pass) imap.logout imap.disconnect 'success' rescue Net::IMAP::NoResponseError 'failure' end end But the rescue clause does not catch all errors: (Net::IMAP::ByeResponseError)948:in `receive_responses': * BYE Autologout; idle for too long from /usr/lib/ruby/1.8/net/imap.rb:932:in `synchronize' from /usr/lib/ruby/1.8/net/imap.rb:932:in `receive_responses' from /usr/lib/ruby/1.8/net/imap.rb:917:in `initialize' from /usr/lib/ruby/1.8/net/imap.rb:916:in `start' from /usr/lib/ruby/1.8/net/imap.rb:916:in `initialize' from test.rb:11:in `new' from test.rb:11:in `tryIMAP' from test.rb:143 from test.rb:100:in `each' from test.rb:100 from test.rb:89:in `each' from test.rb:89 from test.rb:88:in `open' from test.rb:88 How can I catch these errors? -- Posted via http://www.ruby-forum.com/.