tungstenite-rs icon indicating copy to clipboard operation
tungstenite-rs copied to clipboard

Error's `Display` and `Error::source` contain duplicate info

Open vilgotf opened this issue 3 years ago • 1 comments

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.

vilgotf avatar Nov 04 '22 19:11 vilgotf

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.

agalakhov avatar Nov 04 '22 20:11 agalakhov