Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/client/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ pub struct Error {
#[derive(Debug)]
enum ErrorKind {
Canceled,
ChannelClosed,
Connect,
UserUnsupportedRequestMethod,
UserUnsupportedVersion,
Expand Down Expand Up @@ -686,7 +687,7 @@ impl<B> PoolClient<B> {
) -> Poll<Result<(), Error>> {
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(())),
}
Expand Down Expand Up @@ -739,23 +740,23 @@ impl<B: Body + 'static> PoolClient<B> {
#[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"))]
return match self.tx {
#[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")]
return match self.tx {
#[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?
Expand Down Expand Up @@ -1456,4 +1457,8 @@ impl Error {
fn tx(src: hyper::Error) -> Self {
e!(SendRequest, src)
}

fn closed(src: hyper::Error) -> Self {
e!(ChannelClosed, src)
}
}