help with exceptions

cutelucks Ms
Wed, 22 Apr 2009 14:19:09 -0000

Hello,

I was trying to to write a simple ruby program for exceptions.
My code is:

class ABC

begin
alpha = ABC.new
alpha.foo= [1,2,3]
puts foo.inspect.to_s
NonExisting
raise "all other exceptions"
rescue Exception => NoMethodError
puts ''Hello''
puts $ERROR_INFO.inspect
rescue Exception => NameError
puts ''goodbye''
puts $ERROR_INFO.inspect
else
ensure
#pass through and fail naturally
end

end



when i execute this, i always get the output as
Hello
nil

I am unable to understand why the NonExisting is not calling the
nameerror.
can someone help me with this.

Thanx in advance.
--
Posted via http://www.ruby-forum.com/.