Skip to content

Commit

Permalink
feat: improve error msg when state streaming API is unimplemented (#598)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rustin170506 authored Nov 11, 2024
1 parent 7c1f9f2 commit 6ef148a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tokio-console/src/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,18 @@ impl Connection {
let update_stream =
Box::new(client.watch_updates(update_request).await?.into_inner());
let state_request = tonic::Request::new(StateRequest {});
let state_stream = Box::new(client.watch_state(state_request).await?.into_inner());
let state_stream = match client.watch_state(state_request).await {
Ok(stream) => Box::new(stream.into_inner()),
Err(e) => {
if e.code() == tonic::Code::Unimplemented {
tracing::error!(
"The server at {} does not support state streaming. Please update the console-subscriber to v0.5.0 or later version.",
self.target
);
}
return Err(e.into());
}
};
Ok::<State, Box<dyn Error + Send + Sync>>(State::Connected {
client,
update_stream,
Expand Down

0 comments on commit 6ef148a

Please sign in to comment.