rust-cli / human-panic

Panic messages for humans.
https://docs.rs/human-panic
Apache License 2.0
1.66k stars 65 forks source link

🙋 Suggestion: Start printing backtrace from panic's position #52

Closed DoumanAsh closed 5 years ago

DoumanAsh commented 5 years ago

Looking at the way human-panic handles backtrace, I feel like it would be better to suggest to stop printing unnecessary frames we get from backtrace as it has own calls, and instead jump straight to user code. This is how I made for my lazy panic handlers when backtrace is on https://github.com/DoumanAsh/lazy-panic.rs/blob/master/src/formatter.rs#L189-L202

Expected Behavior

Prints stacktrace from user code

Current Behavior

Prints stacktrace from human-panic and its dependency backtrace

Possible Solution

Calculate where user code's panic starts and start printing from this point (Not sure if it is platform dependent number, but both windows and linux had the same stack trace in my experiments)

Context

I just feel it would improve usability for reports with backtrace

spacekookie commented 5 years ago

Yea, this is a good idea. I just tagged this in for the 2.0 release, even though its not technically a breaking change.