Forum: Ruby ruby "better" unhandled exception output.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Rooger Pack (Guest)
on 2009-01-11 07:34
(Received via mailing list)
Inspired by some blog post, unroller, Tracer, and Python, I bring you.

backtracer

why: the default unhandled exception screen output is somewhat sparse:
ex:

ruby crash.rb
crash.rb:6:in `go2': unhandled exception
        from crash.rb:11:in `go'
        from crash.rb:15

The new backtracer, however:

ruby -rbacktracer crash.rb

unhandled exception: crash.rb:6:   raise
        locals: {"a"=>"3", "b"=>3, "within_go2"=>4}
          from:
        crash.rb:1 go2(a=>3, b=>55)
                locals: {"a"=>"3", "b"=>3, "within_go2"=>4}
        crash.rb:8 go(a=>3)
                locals: {"a"=>"3", "within_go"=>2}


How to use:
# copy backtracer.rb to pwd from
http://github.com/rogerdpack/ruby_backtracer/tree/master
gem install ruby-debug # if you don't have it installed

then run as ruby -rbacktracer script_name

Sorry it's not a gem yet, should be by next week.
Feedback welcome.
Enjoy!
-=r
This topic is locked and can not be replied to.