File tree 2 files changed +5
-3
lines changed
2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -844,9 +844,7 @@ impl<'u> ClientBuilder<'u> {
844
844
let status = StatusCode :: from_u16 ( response. subject . 0 ) ;
845
845
846
846
if status != StatusCode :: SwitchingProtocols {
847
- return Err ( WebSocketError :: ResponseError (
848
- "Status code must be Switching Protocols" ,
849
- ) ) ;
847
+ return Err ( WebSocketError :: StatusCodeError ( status) ) ;
850
848
}
851
849
852
850
let key = self
Original file line number Diff line number Diff line change 1
1
//! The result type used within Rust-WebSocket
2
2
3
+ use hyper:: status:: StatusCode ;
3
4
use hyper:: Error as HttpError ;
4
5
use server:: upgrade:: HyperIntoWsError ;
5
6
use std:: convert:: From ;
@@ -40,6 +41,8 @@ pub enum WebSocketError {
40
41
ResponseError ( & ' static str ) ,
41
42
/// Invalid WebSocket data frame error
42
43
DataFrameError ( & ' static str ) ,
44
+ /// Received unexpected status code
45
+ StatusCodeError ( StatusCode ) ,
43
46
/// No data available
44
47
NoDataAvailable ,
45
48
/// An input/output error
@@ -90,6 +93,7 @@ impl Error for WebSocketError {
90
93
WebSocketError :: TlsHandshakeInterruption => "TLS Handshake interrupted" ,
91
94
WebSocketError :: Utf8Error ( _) => "UTF-8 failure" ,
92
95
WebSocketError :: WebSocketUrlError ( _) => "WebSocket URL failure" ,
96
+ WebSocketError :: StatusCodeError ( _) => "Received unexpected status code" ,
93
97
}
94
98
}
95
99
You can’t perform that action at this time.
0 commit comments