Printing stacktrace

I am trying the following in the irb console

begin
a = 4
a.dfsdfadsf
rescue => exp
puts exp.backtrace.join("\n")
else
puts “in else”
ensure
puts “ensure”
end

I am hoping to see a stacktrace of exception complaining about
method_missing for Fixnum but instead I get

(eval):3:in execute' /usr/local/lib/ruby/gems/1.8/gems/interactive_editor-0.0.4/lib/ interactive_editor.rb:33:inedit’
/usr/local/lib/ruby/gems/1.8/gems/interactive_editor-0.0.4/lib/
interactive_editor.rb:42:in edit' /usr/local/lib/ruby/gems/1.8/gems/interactive_editor-0.0.4/lib/ interactive_editor.rb:80:ined’
(irb):32:in irb_binding' /usr/local/lib/ruby/1.8/irb/workspace.rb:52:inirb_binding’
/usr/local/lib/ruby/1.8/irb/workspace.rb:52

Is this a problem with interactive editor or am I not doing it right?

Thanks

On 7 September 2010 00:15, badnaam [email protected] wrote:

I am trying the following in the irb console

begin
a = 4
a.dfsdfadsf
rescue => exp

Should that be rescue Exception => exp?

Colin

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