@@ -26,18 +26,20 @@ pub fn connect(host: Host,
2626 let inner = match host {
2727 Host :: Tcp ( ref host) => {
2828 Either :: A ( tokio_dns:: tcp_connect ( ( & * * host, port) , handle. remote ( ) . clone ( ) )
29- . map ( |s| Stream ( InnerStream :: Tcp ( s) ) ) )
29+ . map ( |s| Stream ( InnerStream :: Tcp ( s) ) )
30+ . map_err ( ConnectError :: Io ) )
3031 }
3132 #[ cfg( unix) ]
3233 Host :: Unix ( ref host) => {
3334 let addr = host. join ( format ! ( ".s.PGSQL.{}" , port) ) ;
3435 Either :: B ( UnixStream :: connect ( addr, handle)
3536 . map ( |s| Stream ( InnerStream :: Unix ( s) ) )
37+ . map_err ( ConnectError :: Io )
3638 . into_future ( ) )
3739 }
3840 #[ cfg( not( unix) ) ]
3941 Host :: Unix ( _) => {
40- Either :: B ( Err ( ConnectError :: ConnectParams ( "unix sockets are not supported on this platform" ) ) . into_future ( ) )
42+ Either :: B ( Err ( ConnectError :: ConnectParams ( "unix sockets are not supported on this platform" . into ( ) ) ) . into_future ( ) )
4143 }
4244 } ;
4345
@@ -49,7 +51,6 @@ pub fn connect(host: Host,
4951 let s: Box < TlsStream > = Box :: new ( s) ;
5052 s. framed ( PostgresCodec )
5153 } )
52- . map_err ( ConnectError :: Io )
5354 . boxed ( )
5455 } ,
5556 } ;
@@ -59,9 +60,9 @@ pub fn connect(host: Host,
5960 let mut buf = vec ! [ ] ;
6061 frontend:: ssl_request ( & mut buf) ;
6162 s. send ( buf)
63+ . map_err ( ConnectError :: Io )
6264 } )
63- . and_then ( |s| s. into_future ( ) . map_err ( |e| e. 0 ) )
64- . map_err ( ConnectError :: Io )
65+ . and_then ( |s| s. into_future ( ) . map_err ( |e| ConnectError :: Io ( e. 0 ) ) )
6566 . and_then ( move |( m, s) | {
6667 let s = s. into_inner ( ) ;
6768 match ( m, required) {
0 commit comments