@@ -64,8 +64,22 @@ pub enum WebSocketOtherError {
6464
6565impl fmt:: Display for WebSocketOtherError {
6666 fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
67- fmt. write_str ( "WebSocketError: " ) ?;
68- fmt. write_str ( self . description ( ) ) ?;
67+ match self {
68+ WebSocketOtherError :: RequestError ( e) => write ! ( fmt, "WebSocket request error: {}" , e) ?,
69+ WebSocketOtherError :: ResponseError ( e) => write ! ( fmt, "WebSocket request error: {}" , e) ?,
70+ WebSocketOtherError :: StatusCodeError ( e) => write ! (
71+ fmt,
72+ "WebSocketError: Received unexpected status code ({})" ,
73+ e
74+ ) ?,
75+ WebSocketOtherError :: HttpError ( e) => write ! ( fmt, "WebSocket HTTP error: {}" , e) ?,
76+ WebSocketOtherError :: UrlError ( e) => write ! ( fmt, "WebSocket URL parse error: {}" , e) ?,
77+ WebSocketOtherError :: IoError ( e) => write ! ( fmt, "WebSocket I/O error: {}" , e) ?,
78+ WebSocketOtherError :: WebSocketUrlError ( e) => e. fmt ( fmt) ?,
79+ #[ cfg( any( feature = "sync-ssl" , feature = "async-ssl" ) ) ]
80+ WebSocketOtherError :: TlsError ( e) => write ! ( fmt, "WebSocket SSL error: {}" , e) ?,
81+ _ => write ! ( fmt, "WebSocketError: {}" , self . description( ) ) ?,
82+ }
6983 Ok ( ( ) )
7084 }
7185}
0 commit comments