Replies: 2 comments 2 replies
-
Regarding error reporting, the next version will feature an extension to the root crate documentation on the subject (#466). You can see the preview here. The documentation already contains some interesting examples (such as trying to open a file). Ultimately, this becomes a matter of striking a balance between use case coverage and readability without excessive verbosity. |
Beta Was this translation helpful? Give feedback.
-
One of my super-long-term stretch goals is to really dig into something like Diátaxis and see how SNAFU could leverage it. One pain that I've felt is how one person wants the documentation to be one way and then another wants it a completely different way. The only solution I know of is to create multiple types of documentation which then incurs overhead and maintenance problems.
I can tell you what I do, which doesn't mean it's best for you. Specifically, I attempt to never use whatevers or locations / backtraces. Instead, I create a lot of error types (recently experimenting with one error type per function) and never construct the same error in more than one location. As for reporting the error, that depends a lot on what kind of program you are writing. A CLI tool can use |
Beta Was this translation helpful? Give feedback.
-
I am having a hard time going through the guide.
What I'd actually like to see in the guide is a link to a github repo with a real-like example of a tiny project that uses snafu in some "best practices" manner.
E.g. I wrote a simple project:
and when I run it it prints:
instead of ... something nicer. And now what? Do I need to register something? Bring another crate?
The examples in the user guide are just isolated modules, and generally reading
[source]
is meh UX.Edit: I needed
#[snafu::report]
onmain
.But again - the current model of a rustdoc based "user guide" ... is not my favourite and actually locally cloning some real code playing with it, running etc. would work much better for me.
Beta Was this translation helpful? Give feedback.
All reactions