Version
f1b89c1
Platform
Any
Description
Today the std::fmt::Display impl for hyper::Error has the following snippet:
|
if let Some(ref cause) = self.inner.cause { |
|
write!(f, "{}: {}", self.description(), cause) |
and the std::error::Error::source impl for hyper::Error reads as such:
|
self.inner |
|
.cause |
|
.as_ref() |
|
.map(|cause| &**cause as &(dyn StdError + 'static)) |
This is somewhat problematic for code that properly prints out the error causation chain. e.g. I have seen an error like this:
error: error trying to connect: tcp connect error: Connection refused (os error 111)
caused by: tcp connect error: Connection refused (os error 111)
caused by: Connection refused (os error 111)
this is pretty unreadable. Now one might argue that hyper::Error::description() serves this use-case, and while that's true, it seems pretty awkward to pull in hyper into the code that's implements error presentation layer just to downcast and check for hyper.
Version
f1b89c1
Platform
Any
Description
Today the
std::fmt::Displayimpl forhyper::Errorhas the following snippet:hyper/src/error.rs
Lines 500 to 501 in f1b89c1
and the
std::error::Error::sourceimpl forhyper::Errorreads as such:hyper/src/error.rs
Lines 510 to 513 in f1b89c1
This is somewhat problematic for code that properly prints out the error causation chain. e.g. I have seen an error like this:
this is pretty unreadable. Now one might argue that
hyper::Error::description()serves this use-case, and while that's true, it seems pretty awkward to pull in hyper into the code that's implements error presentation layer just to downcast and check forhyper.