From: Michael Mueller Date: 2004-08-09T16:16:20+09:00 Subject: Problem with exception not beeing caught Dear rubyists! I have a problem with a small programm, that's fetching emails from my account and then goes to sleep for X seconds. The code looks somehow like this: loop do begin load FILTERFILE BOXES.each{|box| check_mailbox(box)} $log.debug("Gehe f�r #{SLEEPTIME} Sekunden schlafen!") sleep(SLEEPTIME) rescue $log.warn("Fehler aufgetreten:#{$!}\n#{$!.backtrace}") end end From time to time I get an exception in check_mailbox because the mailserver doesn't respond so I'm gettin: mi@ceres:~$ mail-forward.rb -n /usr/local/lib/ruby/1.8/timeout.rb:42:in `new': execution expired (Timeout::Error) from /usr/local/lib/ruby/1.8/net/protocol.rb:83:in `connect' from /usr/local/lib/ruby/1.8/net/protocol.rb:82:in `timeout' from /usr/local/lib/ruby/1.8/timeout.rb:55:in `timeout' from /usr/local/lib/ruby/1.8/net/protocol.rb:82:in `connect' from /usr/local/lib/ruby/1.8/net/protocol.rb:64:in `initialize' from /usr/local/lib/ruby/1.8/net/pop.rb:427:in `open' from /usr/local/lib/ruby/1.8/net/pop.rb:427:in `do_start' from /usr/local/lib/ruby/1.8/net/pop.rb:415:in `start' from /home/mi/bin/mail-forward.rb:45:in `check_mailbox' from /home/mi/bin/mail-forward.rb:89 from /home/mi/bin/mail-forward.rb:89:in `each' from /home/mi/bin/mail-forward.rb:89 from /home/mi/bin/mail-forward.rb:86:in `loop' from /home/mi/bin/mail-forward.rb:86 I guess that's kinda normal, but: Why isn't this exception caught???? I expected the exception in my logfile and the program to continue, but obviously the program exits before getting into the rescue block?? Any ideas what i'm doing wrong? Michael