Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Reverse order for stacktrace #154

Open
kdheepak opened this issue Jul 28, 2024 · 2 comments
Open

Reverse order for stacktrace #154

kdheepak opened this issue Jul 28, 2024 · 2 comments

Comments

@kdheepak
Copy link

kdheepak commented Jul 28, 2024

Thanks for the amazing package!

I wanted to check if there was a way to reverse the stacktrace produced by color_eyre? If there isn't a way to reverse the stacktrace, I wanted to check if the authors would consider a PR to add an option to reverse the stacktrace (defaulting to the way it is right now).

For context:

For long stacktraces, it's nicer to have the most recent stack at the bottom of the terminal to avoid having to scroll up every time there's an error. This is particularly annoying when working in terminal environments when I don't have a mouse handy for scrolling or the terminal doesn't handle mouse scrolling well (remote machines) or when the scrollback history is limited.

Python prints stacktraces in reverse, and in Rust better-panic offers a setting to change the order: https://docs.rs/better-panic/latest/better_panic/struct.Settings.html#method.most_recent_first

I also looked at other languages but pretty much every language (Java, Go, Ruby, etc) seems to do stacktraces with the most recent at the top. When looking at other languages, I found this article that illustrates my pain point pretty well. I'm not sure I necessarily agree with the conclusion of the author, I'm sure there are good reasons for the status quo, but I agree with the idea that stacktraces should be reversed when printed to the terminal: http://yellerapp.com/posts/2015-01-22-upside-down-stacktraces.html

This has also been discussed on the rust issue tracker: rust-lang/rust#38873 although no changes were made to support this feature.

@ten3roberts
Copy link
Contributor

Hi, thanks for opening this issue.

I am definitely open to add that, and agree that it feels more "natural"

A PR would 100% be appreciate, but please open it in the main eyre repo, as this one has been merged into the monorepo

I do not have the "Archive" privileges, only a maintainer

@kdheepak
Copy link
Author

Thanks for the information! I wasn't aware this repo wasn't the source code. I'll make a PR to the main eyre repo.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants