in reply to Re: How to print the backtrace in a "catch" block?
in thread How to print the backtrace in a "catch" block?
What I'm hoping for:runtime error at - line 6. the transaction failed at - line 23 main::main_sub() called at - line 27
Or perhaps in Ruby code:runtime error at - line 6. the transaction failed at - line 23 main::sub3() called at - line 3 main::sub1() called at - line 13 main::main_sub() called at - line 27
def dying_sub raise RuntimeError, "reason here" end def main begin dying_sub() rescue RuntimeError => e STDERR.puts e.backtrace end end main() # Output: # test.rb:2:in `dying_sub' # test.rb:7:in `main' # test.rb:13
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to print the backtrace in a "catch" block?
by Corion (Patriarch) on Jan 16, 2012 at 16:18 UTC | |
by Anonymous Monk on Jan 16, 2012 at 17:15 UTC | |
by tobyink (Canon) on Jan 16, 2012 at 17:25 UTC | |
by Marshall (Canon) on Jan 16, 2012 at 17:20 UTC | |
by Anonymous Monk on Jan 16, 2012 at 16:31 UTC |