File tree 3 files changed +4
-2
lines changed
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 {
109
109
) -> Result < RequestWriter < ' _ > , client:: Error > {
110
110
self . connection
111
111
. as_mut ( )
112
- . expect ( "handshake() to have been called first" )
112
+ . ok_or ( client :: Error :: MissingHandshake ) ?
113
113
. request ( write_mode, on_into_read, trace)
114
114
}
115
115
Original file line number Diff line number Diff line change @@ -333,7 +333,7 @@ impl<H: Http> client::TransportWithoutIO for Transport<H> {
333
333
on_into_read : MessageKind ,
334
334
trace : bool ,
335
335
) -> 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 ) ? ;
337
337
let url = append_url ( & self . url , service. as_str ( ) ) ;
338
338
let static_headers = & [
339
339
Cow :: Borrowed ( self . user_agent_header ) ,
Original file line number Diff line number Diff line change @@ -112,6 +112,8 @@ mod error {
112
112
#[ derive( thiserror:: Error , Debug ) ]
113
113
#[ allow( missing_docs) ]
114
114
pub enum Error {
115
+ #[ error( "A request was performed without performing the handshake first" ) ]
116
+ MissingHandshake ,
115
117
#[ error( "An IO error occurred when talking to the server" ) ]
116
118
Io ( #[ from] std:: io:: Error ) ,
117
119
#[ error( "Capabilities could not be parsed" ) ]
You can’t perform that action at this time.
0 commit comments