File tree Expand file tree Collapse file tree 3 files changed +4
-2
lines changed Expand file tree Collapse file tree 3 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ impl client::TransportWithoutIO for SpawnProcessOnDemand {
109109 ) -> Result < RequestWriter < ' _ > , client:: Error > {
110110 self . connection
111111 . as_mut ( )
112- . expect ( "handshake() to have been called first" )
112+ . ok_or ( client :: Error :: MissingHandshake ) ?
113113 . request ( write_mode, on_into_read, trace)
114114 }
115115
Original file line number Diff line number Diff line change @@ -333,7 +333,7 @@ impl<H: Http> client::TransportWithoutIO for Transport<H> {
333333 on_into_read : MessageKind ,
334334 trace : bool ,
335335 ) -> Result < RequestWriter < ' _ > , client:: Error > {
336- let service = self . service . expect ( "handshake() must have been called first" ) ;
336+ let service = self . service . ok_or ( client :: Error :: MissingHandshake ) ? ;
337337 let url = append_url ( & self . url , service. as_str ( ) ) ;
338338 let static_headers = & [
339339 Cow :: Borrowed ( self . user_agent_header ) ,
Original file line number Diff line number Diff line change @@ -112,6 +112,8 @@ mod error {
112112 #[ derive( thiserror:: Error , Debug ) ]
113113 #[ allow( missing_docs) ]
114114 pub enum Error {
115+ #[ error( "A request was performed without performing the handshake first" ) ]
116+ MissingHandshake ,
115117 #[ error( "An IO error occurred when talking to the server" ) ]
116118 Io ( #[ from] std:: io:: Error ) ,
117119 #[ error( "Capabilities could not be parsed" ) ]
You can’t perform that action at this time.
0 commit comments