## Adapted from IronRuby tests (Runtime\Exception\test_rescue_modifier.rb)
def foo
def f1
begin
require "not_existing"
rescue
puts "not OK f1"
end
end
begin
f1
rescue LoadError
puts "OK f1"
end
def f2
require "not_existing" rescue puts "not OK f2"
end
begin
f2
rescue LoadError
puts "OK f2"
end
end
foo
Expected output:
OK f1
OK f2
Actual output:
OK f1
not OK f2
A "rescue" clause should only catch exceptions that inherit from
StandardError, so therefore f2 is not behaving correctly since LoadError
does not inherit from StandardError. Note that it works fine when there is
also a "begin" clause.
Original issue reported on code.google.com by meaningi...@gmail.com on 4 Oct 2007 at 4:06
Original issue reported on code.google.com by
meaningi...@gmail.com
on 4 Oct 2007 at 4:06