Project

dexc

0.0
No commit activity in last 3 years
No release in over 3 years
Automatically start the REPL and show trace on an exception to debug.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

dexc¶ ↑

About¶ ↑

Automatically start the REPL and show trace on an exception to debug.

Requirements¶ ↑

  • Ruby 2.0.0 or later

  • Pry(optional)

Installation¶ ↑

$ gem install dexc

Examples¶ ↑

$ cat t.rb
def m(obj)
  obj.to_s + 1
end

m(0)

$ ruby -rdexc t.rb
 0:lib/dexc.rb:82>     tp.enable
   TracePoint#enable: false
 1:lib/dexc.rb:83>   end
   Dexc#start: false
 2:lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45>       return gem_original_require(path)
   Kernel#gem_original_require: true
 3:lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45>       return gem_original_require(path)
   Kernel#require: true
 4:t.rb:0>
   IO#set_encoding: #<File:t.rb (closed)>
 5:t.rb:0>
   IO#set_encoding: #<File:t.rb (closed)>
 6:t.rb:1> def m(obj)
   Module#method_added: nil
 7:t.rb:2>   obj.to_s + 1
   Fixnum#to_s: "0"
 8:t.rb:2>   obj.to_s + 1
   Exception#initialize: #<TypeError: no implicit conversion of Fixnum into String>
 9:t.rb:2>   obj.to_s + 1
   Class#new: #<TypeError: no implicit conversion of Fixnum into String>
10:t.rb:2>   obj.to_s + 1
   Exception#exception: #<TypeError: no implicit conversion of Fixnum into String>
11:t.rb:2>   obj.to_s + 1
   Exception#backtrace: nil

TypeError: no implicit conversion of Fixnum into String
        from t.rb:2:in `+'
        from t.rb:2:in `m'
        from t.rb:4:in `<main>'

From: t.rb @ line 2 Object#m:

    1: def m(obj)
 => 2:   obj.to_s + 1
    3: end

[1] pry(main)> obj
=> 0
[2] pry(main)> hist[7] # or dexc_hist[7]
=> "0"