-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
A-errorArea: error handlingArea: error handlingB-rfcBlocked: More comments would be useful in determine next steps.Blocked: More comments would be useful in determine next steps.
Description
Version
f1b89c1
Platform
Any
Description
Today the std::fmt::Display
impl for hyper::Error
has the following snippet:
Lines 500 to 501 in f1b89c1
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:
Lines 510 to 513 in f1b89c1
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
.
Metadata
Metadata
Assignees
Labels
A-errorArea: error handlingArea: error handlingB-rfcBlocked: More comments would be useful in determine next steps.Blocked: More comments would be useful in determine next steps.