[Ironruby-core] Exception handling discrepancies

Peter Bacon Darwin bacondarwin at googlemail.com
Thu Apr 17 05:51:46 EDT 2008

These bugs are great.  Are you reporting them on the RubyForge IronRuby
site?  That way they won't get lost in the mailing list archives.



From: ironruby-core-bounces at rubyforge.org
[mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Robert Brotherus
Sent: Thursday,17 April 17, 2008 09:31
To: ironruby-core at rubyforge.org
Subject: [Ironruby-core] Exception handling discrepancies


Consider following simple program exceptions.rb:


    a = ABC
    puts "We have exception: " + $!


cruby can treat the exception as string, but rbx fails:


[11:24:38 ~/irb_test] ruby exceptions.rb 
We have exception: uninitialized constant ABC

[11:25:10 ~/irb_test] rbx exceptions.rb 
Snippets:0:in `main': undefined local variable or method `to_str' for
uninitialized constant Object::ABC:NameError (NoMethodError)
        from Snippets:0:in `Initialize'[11:25:16 ~/irb_test] 

The problem can be circumvented currently with to_s:


puts "We have exception: " + $!.to_s

Robert Brotherus
Software architect
Napa Ltd
Tammasaarenkatu 3, Helsinki FI-00180
P.O.Box 470, Helsinki FI-00181

Tel. +358 9 22 813 1 
Direct. +358 9 22 813 611 
GSM +358 45 11 456 02 
Fax. +358 9 22 813 800 

Email: Robert.Brotherus at napa.fi 
www.napa.fi <http://www.napa.fi/>  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/ironruby-core/attachments/20080417/a3c2dc1d/attachment.html 

More information about the Ironruby-core mailing list