rust-cli / human-panic

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

Human panic only when it's intended for humans #48

Closed prasannavl closed 6 years ago

prasannavl commented 6 years ago

Currently the setup_panic! macro sets itself up unconditionally. I think a good default would be to ignore itself if RUST_BACKTRACE is setup up explicitly - that way it's not intended for normal humans, but for an environment that already expects the standard rust backtraces, or for developers who explicitly want to turn this on.

This also makes it immensely useful by default during debugging, and development, as there's no need to wrap the setup_panic around a condition. I like the one setup, and would like to avoid putting an ugly wrapper around it. Clearly, this is not something intended during the development process.

Hopefully, most people feel the same, and this can be the default behavior! :)

yoshuawuyts commented 6 years ago

This sounds reasonable to me!

spacekookie commented 6 years ago

Alternatively we could only set up the panic handler if compiled in release mode.

yoshuawuyts commented 6 years ago

Alternatively we could only set up the panic handler if compiled in release mode.

That's not a bad idea! This is most likely in line with what people would want, behavior-wise anyway. Guess that might be another one for the 2.0 list?

prasannavl commented 6 years ago

@spacekookie Well, does it have to be "alternatively"? :)

How about:

spacekookie commented 6 years ago

We'd need to document this well enough that people don't get confused but yea, that's not a bad workflow!

spacekookie commented 6 years ago

This has now landed in master

prasannavl commented 5 years ago

Ok, looks like this has still not made it to a release. Could we may be add an optional flag into the macro in a non-breaking way to get this without waiting on a full blown release?