tungstenite-rs
tungstenite-rs copied to clipboard
Error's `Display` and `Error::source` contain duplicate info
Error returns duplicate information since the error source is included in both the Display and Error::source, for example logging errors with tracing produce the following:
2022-11-04T19:05:01.777878Z WARN crate: error=websocket errored error.sources=[IO error: unexpected end of file, unexpected end of file]
It would be nice to either include downstream error information in just the Error::source (leaving Display with "IO error") as discussed here: https://github.com/dtolnay/thiserror/issues/38 or to not implement Error::source for the Error::Io variant.
Thank you for pointing on this. This is one of artifacts coming from pre-2018 Rust and from early versions of Tungstenite. This definitely needs reworking.