comprehensive-rust
comprehensive-rust copied to clipboard
`anyhow`: Remove `ReadUsernameError::IoError`
As far as I understand, the example with the anyhow example does not use its special IoError anymore, unlike the previous example with just thiserror.
I think this should be made clear. I considered just adding a // Now unused comment, but I think ti's clearer to just remove the unused code.
As far as I understand, the example with the
anyhowexample does not use its specialIoErroranymore, unlike the previous example with justthiserror.
Oh, are you saying that calling .context(...) converts the type away from io::Error? I had not thought of that...
Exactly.
Tangentially related: https://github.com/dtolnay/thiserror/issues/214
To be more precise, I think the io:Error is wrapped into anyhow::Error as opposed to ReadUsernameError::IoError. I'm not an expert though.
Thanks, I finally tested this and you're spot on with your explanation :smile: