When Ruby raises an exception, it leaves a backtrace to help you figure out where the exception originated in. Skiptrace gives you the bindings as well. This can help you introspect the state of the Ruby program when the exception occurred.
Do not use this gem on production environments. The performance penalty isn't worth it anywhere outside of development.
Skiptrace defines the following API:
Returns all the bindings up to the one in which the exception originated in.
Returns an array of Skiptrace::Location
objects that are like Thread::Backtrace::Location
but also carry a Binding
object for that frame through the #binding
method.
Returns all of the current Ruby execution state bindings. The first one is the current one, the second is the caller one, the third is the caller of the caller one and so on.
CRuby 2.5.0 and above is supported.
To get the best support, run JRuby in interpreted mode.
export JRUBY_OPTS=--dev
Only JRuby 9k is supported.
Internal errors like ZeroDevisionError
aren't caught.
Thanks to John Mair for his work on binding_of_caller, which is a huge inspiration. Thanks to Charlie Somerville for better_errors where the idea comes from. Thanks to Koichi Sasada for the debug inspector API in CRuby.