#403: rescue block executed if exception raised in previous iteration -------------------------------+-------------------------------------------- Reporter: pwil...@… | Owner: lsansone...@… Type: defect | Status: new Priority: major | Milestone: MacRuby 0.5 Component: MacRuby | Keywords: -------------------------------+-------------------------------------------- If a begin/rescue block is inside an iterator and the block raises an exception on the first iteration but calls return on the second iteration, the return is ignored and the rescue block ran a second time. Here is an example:
{{{ def main [1,2].each do |iter| puts "Starting iteration #{iter}" begin if iter == 1 raise StandardError end puts " Successful iteration #{iter}" return true rescue StandardError puts " Failed iteration #{iter}" next end end return false end puts main }}} In Ruby 1.8.7, the main method returns true, but in the Oct 24 nightly build of MacRuby, it returns false with this output: {{{ Starting iteration 1 Failed iteration 1 Starting iteration 2 Successful iteration 2 Failed iteration 2 false }}} Note that on the second iteration, both the Successful and Failed log messages get printed. -- Ticket URL: <http://www.macruby.org/trac/ticket/403> MacRuby <http://macruby.org/> _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel