While the Result type doesn't care about the type it returns in the Err branch, returning String instances for error messages is not ideal either. Typical errors have several things to consider:
- Is there a root cause or error?
- What is the error message?
- Is there a more in-depth message to output?
The standard library's errors all follow a common trait from std::error::Error—let's see how they are implemented.