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/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to