How do I get ruby to print a full backtrace instead of a truncated one?
Exception#backtrace has the entire stack in it:
def do_division_by_zero; 5 / 0; endbegin do_division_by_zerorescue => exception puts exception.backtrace raise # always reraiseend
(Inspired by Peter Cooper's Ruby Inside blog)
This produces the error description and nice clean, indented stacktrace:
begin # Some exception throwing coderescue => e puts "Error during processing: #{$!}" puts "Backtrace:\n\t#{e.backtrace.join("\n\t")}"end