I have Ruby function, like this:
module MyModule
def function
raise ArgumentException if true
end
end
Then, I use this function in some another nesting functions just like
def upperfunction
MyModule::function
end
So, if i call upperfunction in irb, i want to see full trace like
line 2 upperfunction.rb
line 3 my_module.rb
ArgumentError
But I get only
line 3 my_module.rb
ArgumentError
What ahould I do to see full trace?
Try $@
. That contains the backtrace of the last exception (the last exception object is in $!
).
An alternative solution would be to use a better ruby shell, pry, in which you can see backtraces with the wtf!
command (the more exclamation points, the more of the backtrace will be shown)