Comment Comment by jrimbault Just to point out for other readers, nowadays to make a custom error type you just need :- an enum (or struct)- its Display implementation- its Error implementation, now just one functionAnd a few `impl From<OtherError> for MyError` to make the try? operator work.For a library it's really not that much work. And even that can be simplified further to a few derive macros with another library : thiserror. parent jrimbault 6 years ago
- an enum (or struct)
- its Display implementation
- its Error implementation, now just one function
And a few `impl From<OtherError> for MyError` to make the try? operator work.
For a library it's really not that much work. And even that can be simplified further to a few derive macros with another library : thiserror.