Skip to content

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

Open
@tingerrr

Description

@tingerrr

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions