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

ser::Error completely hides inner io::Error #1169

Open
tingerrr opened this issue Aug 7, 2024 · 0 comments
Open

ser::Error completely hides inner io::Error #1169

tingerrr opened this issue Aug 7, 2024 · 0 comments

Comments

@tingerrr
Copy link

tingerrr commented Aug 7, 2024

I am using anyhow in a CLI project, which filters out broken pipe errors at the top level main. When writing JSON directly to a closed stdout the returned root_cause is the JSON ser::Error itself, not the underlying io::Error.

It turns out, the implementation of Error::source for ser::Error does not return the actual source of the JSON Error, but the transitive source of its inner io::Error. This was introduced in #992.

I think it would probably be better to return the correct Error::source and simply format the io case for ser::Error as an io error occured to avoid the dupe message.

@tingerrr tingerrr changed the title Error completely hides io::Error ser::Error completely hides inner io::Error Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant