File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,7 +56,9 @@ impl From<ImpitPyError> for pyo3::PyErr {
5656 ImpitPyError ( ImpitError :: WriteTimeout ) => WriteTimeout :: new_err ( format ! ( "{}" , err. 0 ) ) ,
5757 ImpitPyError ( ImpitError :: PoolTimeout ) => PoolTimeout :: new_err ( format ! ( "{}" , err. 0 ) ) ,
5858 ImpitPyError ( ImpitError :: NetworkError ) => NetworkError :: new_err ( format ! ( "{}" , err. 0 ) ) ,
59- ImpitPyError ( ImpitError :: ConnectError ) => ConnectError :: new_err ( format ! ( "{}" , err. 0 ) ) ,
59+ ImpitPyError ( ImpitError :: ConnectError ( _) ) => {
60+ ConnectError :: new_err ( format ! ( "{}" , err. 0 ) )
61+ }
6062 ImpitPyError ( ImpitError :: ReadError ) => ReadError :: new_err ( format ! ( "{}" , err. 0 ) ) ,
6163 ImpitPyError ( ImpitError :: WriteError ) => WriteError :: new_err ( format ! ( "{}" , err. 0 ) ) ,
6264 ImpitPyError ( ImpitError :: CloseError ) => CloseError :: new_err ( format ! ( "{}" , err. 0 ) ) ,
Original file line number Diff line number Diff line change @@ -34,8 +34,8 @@ pub enum ImpitError {
3434 PoolTimeout ,
3535 #[ error( "Network error occurred." ) ]
3636 NetworkError ,
37- #[ error( "Failed to connect to the server." ) ]
38- ConnectError ,
37+ #[ error( "Failed to connect to the server.\n Reason: {0} " ) ]
38+ ConnectError ( String ) ,
3939 #[ error( "Failed to read data from the server." ) ]
4040 ReadError ,
4141 #[ error( "Failed to write data to the server." ) ]
@@ -107,17 +107,17 @@ impl ImpitError {
107107 . source ( )
108108 . and_then ( |e| e. downcast_ref :: < hyper_util:: client:: legacy:: Error > ( ) )
109109 {
110- if source_error. is_connect ( ) {
111- return ImpitError :: ConnectError ;
112- }
113-
114110 if let Some ( e) = source_error. source ( ) {
115111 if let Some ( hyper_error) = e. downcast_ref :: < hyper:: Error > ( ) {
116112 if hyper_error. is_incomplete_message ( ) {
117113 return ImpitError :: RemoteProtocolError ;
118114 }
119115 }
120116 }
117+
118+ if source_error. is_connect ( ) {
119+ return ImpitError :: ConnectError ( format ! ( "{source_error:#?}" ) ) ;
120+ }
121121 }
122122 }
123123
You can’t perform that action at this time.
0 commit comments