How can I modify how much of the exception backtrace gets printed by
ruby for an unhandled exception? When an exception is raised deep in the
caller stack, I see the bottom of the stack printed, then something like
… 11 levels…
And then the top of the stack. What do I do if I’m interested in the
omitted part?
I’d prefer to do it wihout having to catch the exception myself, rather
have just this little behaviour modified.
I had a look at the sources but all there is: #define TRACE_MAX (TRACE_HEAD+TRACE_TAIL+5) #define TRACE_HEAD 8 #define TRACE_TAIL 5
in eval.c
it seems to me, that the number of outputlines is hardcoded. So only
recompile helps. I tested it (changed the values to 20) and it works.
Can somebody with more core-dev experience acknowledge this? It would be
cool if one could change this somehow (without recompile).
if you can use irb you might be luckier:
–back-trace-limit n
displays backtrace top n and tail n. The default value is 16.
Peter
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.