Issuing
Issue is a small but detailed error wrapper that can be handled by upstream code and can be built from other types.
The problem it solves
Easy, fast reporting to the user via a CLI with enough information.
Usage
This type is not meant to be used by ordinary people writing code, but by library backends defining custom errors:
use Issue;
Then, libraries might use it in two ways:
- By returning it to the user on
Result<Type, Issue>with standard try-trait workflow, - By submitting it to a type that implements
SystemIO(seesystemiofor that)
When to use it
This error type is meant to be used for errors whose failure might interest the user. Common examples are:
- A file doesn't exist
- The input wasn't correct
- Couldn't fetch
Examples for instances in which you should not use it:
- The program internals failed
For that second case, you should likely use .unwrap() or .expect(&'static str) instead.