Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

anyhow: Remove ReadUsernameError::IoError #49

Merged
merged 2 commits into from
Jan 5, 2023
Merged

Conversation

ilyagr
Copy link
Contributor

@ilyagr ilyagr commented Dec 23, 2022

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.

Fixes #116.

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.
@mgeisler
Copy link
Collaborator

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.

Oh, are you saying that calling .context(...) converts the type away from io::Error? I had not thought of that...

@mgeisler mgeisler self-assigned this Dec 23, 2022
@ilyagr
Copy link
Contributor Author

ilyagr commented Dec 23, 2022

Exactly.

Tangentially related: dtolnay/thiserror#214

@ilyagr
Copy link
Contributor Author

ilyagr commented Dec 23, 2022

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.

@mgeisler
Copy link
Collaborator

mgeisler commented Jan 5, 2023

Thanks, I finally tested this and you're spot on with your explanation 😄

@mgeisler mgeisler merged commit 9a68434 into google:main Jan 5, 2023
@ilyagr ilyagr deleted the patch-1 branch January 6, 2023 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Technical nit: Adding Context to Errors
2 participants