@@ -58,6 +58,7 @@ pub struct Error {
58
58
#[ derive( Debug ) ]
59
59
enum ErrorKind {
60
60
Canceled ,
61
+ ChannelClosed ,
61
62
Connect ,
62
63
UserUnsupportedRequestMethod ,
63
64
UserUnsupportedVersion ,
@@ -686,7 +687,7 @@ impl<B> PoolClient<B> {
686
687
) -> Poll < Result < ( ) , Error > > {
687
688
match self . tx {
688
689
#[ cfg( feature = "http1" ) ]
689
- PoolTx :: Http1 ( ref mut tx) => tx. poll_ready ( cx) . map_err ( |_| todo ! ( ) ) ,
690
+ PoolTx :: Http1 ( ref mut tx) => tx. poll_ready ( cx) . map_err ( Error :: closed ) ,
690
691
#[ cfg( feature = "http2" ) ]
691
692
PoolTx :: Http2 ( _) => Poll :: Ready ( Ok ( ( ) ) ) ,
692
693
}
@@ -739,23 +740,23 @@ impl<B: Body + 'static> PoolClient<B> {
739
740
#[ cfg( feature = "http2" ) ]
740
741
PoolTx :: Http2 ( ref mut tx) => Either :: Right ( tx. send_request ( req) ) ,
741
742
}
742
- . map_err ( |_| todo ! ( ) ) ;
743
+ . map_err ( Error :: tx ) ;
743
744
744
745
#[ cfg( feature = "http1" ) ]
745
746
#[ cfg( not( feature = "http2" ) ) ]
746
747
return match self . tx {
747
748
#[ cfg( feature = "http1" ) ]
748
749
PoolTx :: Http1 ( ref mut tx) => tx. send_request ( req) ,
749
750
}
750
- . map_err ( |_| todo ! ( ) ) ;
751
+ . map_err ( Error :: tx ) ;
751
752
752
753
#[ cfg( not( feature = "http1" ) ) ]
753
754
#[ cfg( feature = "http2" ) ]
754
755
return match self . tx {
755
756
#[ cfg( feature = "http2" ) ]
756
757
PoolTx :: Http2 ( ref mut tx) => tx. send_request ( req) ,
757
758
}
758
- . map_err ( |_| todo ! ( ) ) ;
759
+ . map_err ( Error :: tx ) ;
759
760
}
760
761
/*
761
762
//TODO: can we re-introduce this somehow? Or must people use tower::retry?
@@ -1456,4 +1457,8 @@ impl Error {
1456
1457
fn tx ( src : hyper:: Error ) -> Self {
1457
1458
e ! ( SendRequest , src)
1458
1459
}
1460
+
1461
+ fn closed ( src : hyper:: Error ) -> Self {
1462
+ e ! ( ChannelClosed , src)
1463
+ }
1459
1464
}
0 commit comments