diff --git a/src/client/legacy.rs b/src/client/legacy.rs index d225a9a7..a1edd59e 100644 --- a/src/client/legacy.rs +++ b/src/client/legacy.rs @@ -58,6 +58,7 @@ pub struct Error { #[derive(Debug)] enum ErrorKind { Canceled, + ChannelClosed, Connect, UserUnsupportedRequestMethod, UserUnsupportedVersion, @@ -686,7 +687,7 @@ impl PoolClient { ) -> Poll> { match self.tx { #[cfg(feature = "http1")] - PoolTx::Http1(ref mut tx) => tx.poll_ready(cx).map_err(|_| todo!()), + PoolTx::Http1(ref mut tx) => tx.poll_ready(cx).map_err(Error::closed), #[cfg(feature = "http2")] PoolTx::Http2(_) => Poll::Ready(Ok(())), } @@ -739,7 +740,7 @@ impl PoolClient { #[cfg(feature = "http2")] PoolTx::Http2(ref mut tx) => Either::Right(tx.send_request(req)), } - .map_err(|_| todo!()); + .map_err(Error::tx); #[cfg(feature = "http1")] #[cfg(not(feature = "http2"))] @@ -747,7 +748,7 @@ impl PoolClient { #[cfg(feature = "http1")] PoolTx::Http1(ref mut tx) => tx.send_request(req), } - .map_err(|_| todo!()); + .map_err(Error::tx); #[cfg(not(feature = "http1"))] #[cfg(feature = "http2")] @@ -755,7 +756,7 @@ impl PoolClient { #[cfg(feature = "http2")] PoolTx::Http2(ref mut tx) => tx.send_request(req), } - .map_err(|_| todo!()); + .map_err(Error::tx); } /* //TODO: can we re-introduce this somehow? Or must people use tower::retry? @@ -1456,4 +1457,8 @@ impl Error { fn tx(src: hyper::Error) -> Self { e!(SendRequest, src) } + + fn closed(src: hyper::Error) -> Self { + e!(ChannelClosed, src) + } }