Open BugenZhao opened 1 year ago
Yeah, it seems Report
has a similar idea. However, I have several concerns...
Error
into Report
before printing them out, or they'll lose the information from the sources if {source}
is not included in #[snafu(display(..))]
(which I guess should be a good practice?).Report
always includes the backtrace if provided, which might not be suitable to appear in a user-facing error message. As a result, we have to introduce our own Display
wrapper.I'm not sure if developers always remember
How would this be different from remembering to use the alternate display flag?
which I guess should be a good practice
The current best practice is to do exactly one of:
Display
implementationError::source
Report
always includes the backtrace if provided
Right now, it only happens on nightly Rust if you've enabled the unstable-provider-api
feature flag, but at some point in the future it might happen by default. We might also add some small configuration knobs.
utilized in many other error handling libraries
I believe the big difference is that these other libraries (and I'm not an expert on them) don't actually give you control over the implementation of Display
in the first place, while SNAFU does. For example, could you share your desired syntax to specify the regular and alternate Display
implementations for a SNAFU-enhanced error?
We have had some discussions about some kind of #[snafu(display(false))]
style option that would disable the creation of the Display
implementation, letting the user define it completely by hand. That would allow uncommon / highly special cases without completely jettisoning SNAFU.
Hi, and thanks for your work on this great library!
I'm considering if it's possible to support displaying the source chain with alternate
Display
(i.e.{:#}
), which seems to be a convention for error reporting utilized in many other error handling libraries, includinganyhow
anderror-stack
.