From: Michael Davis Date: 2002-03-11T04:39:39+09:00 Subject: Issue with trapping errors in instance_eval I need to be able to trap error during a call to instance_eval. Here is a code snip-it that closely resembles what I am trying to do. This errors but never hits the rescue clause. Any idea how to trap an error inside a call to instance_eval? a = [1,2] begin a.instance_eval('puts a2.inspect') rescue puts 'error' end I was expecting to see: error however, this little program outputs the following: Exception `NameError' at (eval):1 - undefined local variable or method `a2' for [1, 2]:Array Exception `NameError' at ../test.rb:3 - (eval):1:in `instance_eval': undefined local variable or method `a2' for [1, 2]:Array ../test.rb:3:in `instance_eval': (eval):1:in `instance_eval': undefined local variable or method `a2' for [1, 2]:Array (NameError) from ../test.rb:3:in `instance_eval' from ../test.rb:3 I am running Ruby 1.6.5 on Windows 2000 with the latest version of cygwin. -- Thanks, Michael Davis Database Architect and Senior Software Engineer, Seva Inc. Email: mdavis@sevainc.com