From: Brian Marick Date: 2001-06-29T13:02:13+09:00 Subject: [ruby-talk:17042] rescuing qualified names Does 'rescue' obey the scope operator ::? Suppose I override the token "Exception" in a module: module T class Exception < ::Exception end end Then, if I want a 'rescue' clause to catch all exceptions, I think I should need to qualify it as "::Exception": module T class Zow def raiser begin Zow.new.bogus rescue ::Exception puts 'rescued' # parse error here end end end end However, this yields a parse error (in 1.6.3): (irb):12: parse error rescue ::Exception ^ If I use an expression that returns the constant "::Exception", it parses: module T class Zow def raiser ename = ::Exception begin Zow.new.bogus rescue ename puts "rescued #{$!.class}" end end end end Moreover, it does indeed catch all exceptions: > T::Zow.new.raiser rescued NameError nil Is this a bug? I don't see it in the bug database or the 1.6.3->1.6.4 changes. -- Brian Marick, marick@testing.com www.testing.com - Software testing services and resources www.testingcraft.com - Where software testers exchange techniques www.visibleworkings.com - Adequate understanding of system internals