Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
prasannavl opened this issue Oct 3, 2018 · 7 comments
Closed

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

prasannavl opened this issue Oct 3, 2018 · 7 comments

Comments

@prasannavl
Copy link

prasannavl commented Oct 3, 2018

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
Copy link
Collaborator

This sounds reasonable to me!

@spacekookie
Copy link
Collaborator

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

@yoshuawuyts
Copy link
Collaborator

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
Copy link
Author

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

How about:

  • If RUST_BACKTRACE is present - backoff - let the environment take over.
  • If it's a debug mode build - backoff.
  • Oo, we're still here - play time!

@spacekookie
Copy link
Collaborator

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

spacekookie added a commit that referenced this issue Oct 4, 2018
spacekookie added a commit that referenced this issue Oct 4, 2018
spacekookie added a commit that referenced this issue Oct 4, 2018
* Implementing #48 
* Running rustfmt on the new setup

There will be another commit that adds more documentation for new 1.0+ features across the board
@spacekookie
Copy link
Collaborator

This has now landed in master

@prasannavl
Copy link
Author

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?

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

No branches or pull requests

3 participants