• @brombek
    link
    43 years ago

    It is already possible with https://docs.rs/problem/5.3.0/problem/ crate. You set up panic handler with format_panic_to_stderr() or format_panic_to_error_log() and wrap your errors in Problem type which will follow the Error trait source chain and produce nice message. It can even include stack traces.

    I am not sure if this should be in stdlib since normally panics are bugs and bug reports should be formatted in the way that developers can understand the best. But in CLI programs it is often easier for the developer to just abort with panic on normal errors (not bugs) and then you want nice report for the user by default. This is also the reason why anyhow crate exists. So user friendly panic reporting is a CLI specific problem and not a general Rust issue.