Brian Candler
10/10/2004 11:12:00 AM
On Sun, Oct 10, 2004 at 08:02:20PM +0900, Alexey Verkhovsky wrote:
> Below is a typical Rails exception thrown from within functional tests.
> The interesting part of this exception (test and application code) is
> precisely within "... 18 levels..." that are hidden by the interpreter.
>
> Is there any good way to convince Ruby to print full stack trace?
I had the same issue a couple of years ago, and I ended up grepping through
the interpreter C source for the string "levels..." to find it.
Doing so again... it looks like these are hard-coded constants in eval.c
#define TRACE_HEAD 8
#define TRACE_TAIL 5
So you can change these (and recompile ruby). But I think what I did in the
end was just wrap the code with my own exception catcher, since the full
backtrace array is available to you:
def foo(y)
raise "hell" if y <= 0
foo(y-1)
end
begin
foo(75)
rescue Exception => e
puts "Exception: #{e.class}: #{e.message}\n\t#{e.backtrace.join("\n\t")}"
exit 1
end
Regards,
Brian.