From: Guillaume Marcais Date: 2006-05-19T00:53:18+09:00 Subject: Re: Nested Exceptions Does this answer your question? [gus@gusmac gus]$ cat tmp/exception.rb #! /usr/bin/ruby begin rand > 0.5 and raise "Hi from Murphy!" 10.times do |i| begin i%2 == 0 and raise "Yack, #{i} is even" rescue => e puts("In loop exception: #{e.message}") end end rescue => e puts("Setup failed: #{e.message}") end [gus@gusmac gus]$ ruby tmp/exception.rb Setup failed: Hi from Murphy! [gus@gusmac gus]$ ruby tmp/exception.rb In loop exception: Yack, 0 is even In loop exception: Yack, 2 is even In loop exception: Yack, 4 is even In loop exception: Yack, 6 is even In loop exception: Yack, 8 is even Guillaume. Le 18 mai 06, � 11:24, Joe Seeley a �crit : > Can anyone tell me if Ruby supports nested exceptions correctly? I have > tried finding documentation on this issue, but have come up emtpy > handed. What I want to do is something along the lines of this. > > begin > Some common setup code that could cause an exception goes here > ... > ... > for i in 0..x > begin > # Other exceptions may occur within the loop. > rescue > # If an exception occurs within the loop I want to handle > the > # exception and continue with the loop. > end > end > end > > thanks > -joe > > -- > Posted via http://www.ruby-forum.com/. > >