News for hackers. Stuff that matters.
Re:Rust: Enums to Wrap Multiple Errors by ragnese on Saturday October 09, 2021 @09:44AM (#28809781)
Something worth mentioning is that your error types do NOT have to implement std::error::Error. The type parameters on Result<T, E> have no constraints.

So, only your public API should implement std::error::Error.

Likewise, you don't HAVE TO implement From for all of your error types. In fact, it has some of the same concerns that implicit constructors in C++ have in that it's easy to just throw try-operators around without thinking about whether you actually want to bubble up an error in a specific scenario.

I think a lot of people who pick up Rust might not realize that and end up thinking the error defining process is even more tedious than it really is.

There are no comments on this comment yet.