Redesign Error type
- The `Error`'s kind is a now a set of variants depending on the context of when an error could occur. - If another error was the cause, it is now always the `source`. Along with the `is_*` methods, this should help in understanding *when* a certain error occurred. For example, an error setting the TLS certificates will return a builder error, with the TLS error as the source. This should help differentiate from a TLS error that happens when connecting to a server. It also makes the internal code less dependent on all the exact dependencies that can be enabled or disabled.
This commit is contained in:
@@ -137,14 +137,14 @@ impl Stream for Decoder {
|
||||
let new_value = match self.inner {
|
||||
Inner::Pending(ref mut future) => match Pin::new(future).poll(cx) {
|
||||
Poll::Ready(Ok(inner)) => inner,
|
||||
Poll::Ready(Err(e)) => return Poll::Ready(Some(Err(crate::error::from_io(e)))),
|
||||
Poll::Ready(Err(e)) => return Poll::Ready(Some(Err(crate::error::decode_io(e)))),
|
||||
Poll::Pending => return Poll::Pending,
|
||||
},
|
||||
Inner::PlainText(ref mut body) => return Pin::new(body).poll_next(cx),
|
||||
Inner::Gzip(ref mut decoder) => {
|
||||
return match futures_core::ready!(Pin::new(decoder).poll_next(cx)) {
|
||||
Some(Ok(bytes)) => Poll::Ready(Some(Ok(bytes))),
|
||||
Some(Err(err)) => Poll::Ready(Some(Err(crate::error::from_io(err)))),
|
||||
Some(Err(err)) => Poll::Ready(Some(Err(crate::error::decode_io(err)))),
|
||||
None => Poll::Ready(None),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user