Issue #8661 has been updated by jeremyevans0 (Jeremy Evans).


duerst (Martin D=FCrst) wrote in #note-36:
> I think the option's name (`--suppress-backtrace`) is wrong. If I write `=
--suppress-backtrace=3D10`, 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, su=
ch as `--show-backtrace` or `--print-backtrace` or so, to match its meaning.

I agree the option could have a better name.  I recommend `--backtrace-limi=
t`, as that indicates a numerical setting, as opposed to `--show-backtrace`=
 or `--print-backtrace`, both of which indicate a boolean setting.

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

* 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 s=
croll.
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 wh=
en 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 t=
he 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 t=
his can be done today. I tried overriding `Exception#backtrace`, but it cau=
sed 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=3Dunsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>