# Autoprint of exception backtrace

**URL:** <https://www.ruby-forum.com/t/autoprint-of-exception-backtrace/116713>\
**Category:** Ruby\
**Created:** [October 8, 2007, 11:04pm UTC](https://www.ruby-forum.com/t/autoprint-of-exception-backtrace/116713 "2007-10-08T23:04:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mortee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/50afbb/32.png) [@mortee](https://www.ruby-forum.com/u/mortee)\
**Post date:** [October 8, 2007, 11:04pm UTC](https://www.ruby-forum.com/t/autoprint-of-exception-backtrace/116713/1 "2007-10-08T23:04:48Z")

</div>

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.

thx  
mortee

---

<div class="post-metadata">

**Author:** ![mortee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/50afbb/32.png) [@mortee](https://www.ruby-forum.com/u/mortee)\
**Post date:** [October 29, 2007, 8:25pm UTC](https://www.ruby-forum.com/t/autoprint-of-exception-backtrace/116713/2 "2007-10-29T20:25:28Z")

</div>

Hi mortee,

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
