Skip to content

Commit

Permalink
Add Error::WsOther to wrap unexpected WS errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kazk committed Jan 5, 2021
1 parent d1a502e commit ed3f44d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 1 addition & 3 deletions kube/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,7 @@ impl Client {
| ws2::Error::AlreadyClosed
| ws2::Error::Utf8
| ws2::Error::Capacity(_)
| ws2::Error::SendQueueFull(_) => {
panic!("Unexpected {}", err);
}
| ws2::Error::SendQueueFull(_) => Err(Error::WsOther(err.to_string())),
},
}
}
Expand Down
5 changes: 5 additions & 0 deletions kube/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ pub enum Error {
#[cfg(feature = "native-tls")]
#[error("OpensslError: {0}")]
OpensslError(#[from] openssl::error::ErrorStack),

/// Unexpected error from making WebSocket connection.
#[cfg(feature = "ws")]
#[error("Unexpected WebSocket error: {0}")]
WsOther(String),
}

#[derive(Error, Debug)]
Expand Down

0 comments on commit ed3f44d

Please sign in to comment.