title: Ruby Rescue To Display Full Backtrace
body: <p>Here's a real quick example:</p>
  
  <pre><code>puts File.join(nil, "hello")
  </code></pre>
  
  <p>Would output</p>
  
  <pre><code>test.rb:4:in 'join': can't convert nil into String (TypeError)
  from test.rb:4
  </code></pre>
  
  <p>But when I do this:</p>
  
  <pre><code>begin
    puts File.join(nil, "hello")
  rescue =&gt; exception
    puts exception.backtrace
  end
  </code></pre>
  
  <p>This will output</p>
  
  <pre><code>test.rb:4:in 'join'
  test.rb:4
  </code></pre>
  
  <p>Now how do I capture the full backtrace, including the "can't convert nil into String (TypeError)" part?</p>
  
  <p><strong>@Sarah Vessels:</strong>
  In my specific code, this snippet:</p>
  
  <pre><code>puts "=============================="
  puts error.message
  puts "=============================="
  puts error.inspect
  puts "=============================="
  puts error.backtrace
  puts "=============================="
  </code></pre>
  
  <p>returns</p>
  
  <pre><code>==============================
  exit
  ==============================
  #&lt;SystemExit: exit&gt;
  ==============================
  /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
  ==============================
  </code></pre>