rescue/param_scope_test.rb
tests/_examples/rescue/param_scope_test.rb in the metorex repository.
def test_method(loc, &blk)
begin
blk.call
return "no error"
rescue Object => exc
return "caught: loc=#{loc}"
end
end
result = test_method("my_location") { "hello".bad_method }
puts result
Output:
caught: loc=my_location