Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit100e4eb

Browse files
committed
Improve Display impl for WebSocketOtherError
- provide a more informative message of cause- print actual status code on StatusCodeError (resolvevi/websocat#55)
1 parente9a3c9c commit100e4eb

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

‎src/result.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,22 @@ pub enum WebSocketOtherError {
6464

6565
impl fmt::DisplayforWebSocketOtherError{
6666
fnfmt(&self,fmt:&mut fmt::Formatter) -> fmt::Result{
67-
fmt.write_str("WebSocketError: ")?;
68-
fmt.write_str(self.description())?;
67+
matchself{
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

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp