Exception handling discrepancies

Consider following simple program exceptions.rb:

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

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 methodto_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 B.
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: [email protected] mailto:[email protected]
www.napa.fi http://www.napa.fi/

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.

Pete

From: [email protected]
[mailto:[email protected]] On Behalf Of Robert
Brotherus
Sent: Thursday,17 April 17, 2008 09:31
To: [email protected]
Subject: [Ironruby-core] Exception handling discrepancies

Consider following simple program exceptions.rb:

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

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 methodto_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 B.
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: [email protected]
www.napa.fi http://www.napa.fi/

Bugs 19625 and 19626 submitted to the tracker. Will submit bugs directly
there in the future.

Thanks for reminder.
Robert B.
Software architect
Napa Ltd


From: [email protected]
[mailto:[email protected]] On Behalf Of Peter Bacon
Darwin
Sent: 17. huhtikuuta 2008 12:52
To: [email protected]
Subject: Re: [Ironruby-core] Exception handling discrepancies

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.

Pete

From: [email protected]
[mailto:[email protected]] On Behalf Of Robert
Brotherus
Sent: Thursday,17 April 17, 2008 09:31
To: [email protected]
Subject: [Ironruby-core] Exception handling discrepancies

Consider following simple program exceptions.rb:

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

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 methodto_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 B.
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: [email protected]
www.napa.fi http://www.napa.fi/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs