snafu icon indicating copy to clipboard operation
snafu copied to clipboard

Snafu's name is displayed in error messages

Open pie-flavor opened this issue 7 months ago • 2 comments

When Report cleans a trace, it notifies the user that they can set the environment variable SNAFU_RAW_ERROR_MESSAGES; I don't necessarily want to share environment variables with other tools, or put the names of libraries in boring CLI tool output (similar calculus as RUST_LOG). Can there be a way to override the variable name that gets checked?

pie-flavor avatar May 28 '25 17:05 pie-flavor

Would you mind testing out the report-configuration branch and seeing if it does what you expected? I haven't finished documenting things, or even writing all the tests I want, but I'd rather get feedback before I start ossifying poor decisions.

You should be able to do

#[snafu::report(env("MOO_MOO"), show_note(false))]

Feedback on option names is welcome as well. I think since these options will be so infrequent, I'd rather go for longer rather than shorter, so env might grow to a full word or two.

shepmaster avatar May 29 '25 18:05 shepmaster

An alternate idea I had would to be a bit more structured. E.g. instead of passing in an environment variable name, maybe I pass in a closure that returns a struct that has fn enabled(&self) -> bool and fn show_note(&self) -> bool methods. That way the user of Report could do something more complicated than just an env var.

shepmaster avatar May 30 '25 18:05 shepmaster