From: duerst@... Date: 2020-04-21T23:35:50+00:00 Subject: [ruby-core:98008] [CommonRuby Feature#8661] Add option to print backtrace in reverse order (stack frames first and error last) Issue #8661 has been updated by duerst (Martin D�rst). I think the option's name (`--suppress-backtrace`) is wrong. If I write `--suppress-backtrace=10`, it reads like "suppress 10 entries of backtrace". That would mean if the whole backtrace is 50 entries, it would print 40 entries. The name of the option should be changed to something positive, such as `--show-backtrace` or `--print-backtrace` or so, to match its meaning. ---------------------------------------- Feature #8661: Add option to print backtrace in reverse order (stack frames first and error last) https://bugs.ruby-lang.org/issues/8661#change-85239 * Author: gary4gar (Gaurish Sharma) * Status: Closed * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) ---------------------------------------- Currently, the way ruby prints backtrace is that the error comes first and then the stack frames, like this: ``` Main Error Message stack frame 1 stack frame 2 stack frame 3 ..... ``` This is perfectly fine provided: 1. Backtraces are short, and fits in terminal, hence, there is no need to scroll. 2. You read it from top to bottom. But, I am a rails developer where 1. Backtraces are HUGE, therefore seldom fit in terminal, which means that a LOT of scrolling is needed every time I get an error. 2. In terminal, I tend to read backtraces from bottom to top, especially when tailing (tail -f) production logs. 3. I practice test-driven development, and spend most of my time scrolling to read backtraces, and ended up buying a larger display. Proposed Solution: Please add a way to configure backtraces to be printed in reverse order so that if I am reading from the bottom, say from the terminal, I can get to the main error message without scrolling, like this: ``` stack frame 3 stack frame 2 stack frame 1 Main Error Message ..... ``` This would save a lot of time because when the error message is printed at the bottom, there would be no need to scroll to read it. I am not sure if this can be done today. I tried overriding `Exception#backtrace`, but it caused a stack level too deep and illegal hardware instruction error. Attached is a comparison of how a backtrace currently looks like and how I want the option to make it look. ---Files-------------------------------- current.log (5.13 KB) proposed.log (4.9 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: