rust-cli / human-panic

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

Set authors / homepage in macro invocation #21

Closed colindean closed 6 years ago

colindean commented 6 years ago

šŸ™‹ feature request

Expected Behavior

When my program panics, I want the user to see a support@example.com email and a https://example.com/support link.

Current Behavior

When my program panics, the user sees a developer.name@example.com email and a https://internal.example.com/source-control-system/project-name link because these are what is set in the Cargo.toml.

Possible Solution

It'd be nice to have two macros:

  1. takes no arguments and uses the values from Cargo.
  2. takes one argument, a Metadata struct, and uses that data in the outputted text.

I realize, though, that this getting closer to "custom message text" which could be great if it could be templated in some way.

Examples:

set_panic!()

set_panic!(Metadata{ authors: "support@example.com", homepage: "https://example.com/support" })

Context

This affects me because I'm developing a commercial product in which I'd like to use human-panic and I don't want my developers' individual email addresses to be exposed to the user nor do I want to change the Cargo.toml authors because we're currently using that to track who's knowledgeable of that codebase at the moment.

killercup commented 6 years ago

cc @skade who I talked to about something like this

colindean commented 6 years ago

šŸŽ‰