Here's a real quick example:
puts File.join(nil, "hello")
Would output
test.rb:4:in 'join': can't convert nil into String (TypeError)
from test.rb:4
But when I do this:
begin
puts File.join(nil, "hello")
rescue => exception
puts exception.backtrace
end
This will output
test.rb:4:in 'join'
test.rb:4
Now how do I capture the full backtrace, including the "can't convert nil into String (TypeError)" part?
@Sarah Vessels: In my specific code, this snippet:
puts "=============================="
puts error.message
puts "=============================="
puts error.inspect
puts "=============================="
puts error.backtrace
puts "=============================="
returns
==============================
exit
==============================
#<SystemExit: exit>
==============================
/usr/lib/ruby/1.8/glib2.rb:37:in `exit'
/usr/lib/ruby/1.8/glib2.rb:37:in `exit_application'
multi.rb:234:in `main'
multi.rb:347
==============================