Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails/Ruby: Any way to shorten the stack traces?

I would like to limit the size of the stack traces I am seeing in Rails. I'm not really interested in debugging the Rails stack as much as my own application. Is there any built-in way to have Rails do this dynamically?

like image 343
Dan Rosenstark Avatar asked Jun 16 '09 18:06

Dan Rosenstark


2 Answers

Yes. Take a look at the ActiveSupport::BacktraceCleaner class. Nice explanation here.

like image 149
John Topley Avatar answered Sep 21 '22 16:09

John Topley


You could wrap the code with your own exception catcher and just output how much you want.

Using the array from the backtrace-Method

Only alternative I could think of. Recompiling Ruby and changing the values which control the stack depth in eval.c (TRACE_HEAD and TRACE_TAIL)

like image 34
jitter Avatar answered Sep 18 '22 16:09

jitter