How do I get ruby to print a full backtrace instead of a truncated one?

前端 未结 10 1590
-上瘾入骨i
-上瘾入骨i 2020-12-12 12:00

When I get exceptions, it is often from deep within the call stack. When this happens, more often than not, the actual offending line of code is hidden from me:



        
10条回答
  •  旧巷少年郎
    2020-12-12 12:40

    IRB has a setting for this awful "feature", which you can customize.

    Create a file called ~/.irbrc that includes the following line:

    IRB.conf[:BACK_TRACE_LIMIT] = 100
    

    This will allow you to see 100 stack frames in irb, at least. I haven't been able to find an equivalent setting for the non-interactive runtime.

    Detailed information about IRB customization can be found in the Pickaxe book.

提交回复
热议问题