Issue #8661 has been updated by mame (Yusuke Endoh).


The order had been already reverted in #note-31.

----------------------------------------
Feature #8661: Add option to print backtrace in reverse order (stack frames first and error last)
https://bugs.ruby-lang.org/issues/8661#change-85804

* 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: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>