From: Michael Davis Date: 2002-03-11T08:15:37+09:00 Subject: Re: Issue with trapping errors in instance_eval Dave Thomas wrote: > "Filip Moens" writes: > > >>On my machine (Windows 2000), this problem indeed occurs with Ruby 1.6.6 and >>1.6.7. >>The error is caugth correctly with Ruby 1.7.2. >> > > It isn't really an error - a 'rescue' clause without specific > exceptions only catches exceptions of class StandardError and its > children. > > On 1.6, NameError is a child of ScriptError, which is a child of the > base class Exception. Therefore, a simple 'rescue' won't catch > it. However > > rescue Exception > > or > > rescue ScriptError > > or > > rescue NameError > > will. > > Under 1.7, the exception hierarchy has changed. Now NameError's parent > is StandardError, and so it's caught by a default rescue clause. > > > Dave > > > Excellent! Thanks for the explaination. -- Michael Davis Database Architect and Senior Software Engineer, Seva Inc. Email: mdavis@sevainc.com