`ser::Error` completely hides inner `io::Error`
Opened this issue · 0 comments
tingerrr commented
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.