Issue #839 has been updated by Thomas Sawyer.


If all it is, is to add source code line to backtrace then I don think that's enough.

I think the feature people would like to see in this area is an objectified backtrace, e.g.

    error.objectified_backtrace.each do |b|
      b.file    #=> '/home/pwilliams/projects/tmp/test.rb'
      b.line    #=> 18
      b.in      #=> "<main>"
      b.source  #=> "greet_user(nil, \"williams\")"
      b.to_s    #=> "from /home/pwilliams/projects/tmp/test.rb:18:in `<main>'"

I believe there is a gem called 'callsite' which does something like this. Maybe others too.





----------------------------------------
Feature #839: Add code on each line of a backtrace output to the screen
https://bugs.ruby-lang.org/issues/839

Author: Roger Pack
Status: Assigned
Priority: Normal
Assignee: Yukihiro Matsumoto
Category: core
Target version: 2.0.0


=begin
 This patch adds output to unrescued exceptions' output to the command line:
 
 C:\dev\downloads\snap_snapshot>cat bad2.rb
 def bad
  raise
 end
 def good
  bad
 end
 good
 
 > ruby19 bad2.rb
 bad2.rb:2:in `bad': unhandled exception
                  raise
         from bad2.rb:5:in `good'
                  bad
         from bad2.rb:7:in `<main>'
                  good
 
 Wasn't sure if there is a better way to code this up or what not, but here it is.  Similar measures could be applied to 1.8.7.
 Thanks!
 -=R
=end



-- 
http://bugs.ruby-lang.org/