Skip to content

Commit

Permalink
Rust: fix panic with normal errors (versatica#1377)
Browse files Browse the repository at this point in the history
  • Loading branch information
satoren authored Apr 16, 2024
1 parent d534be0 commit d6373d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions rust/src/router/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1020,9 +1020,9 @@ impl Consumer {
.inner
.channel
.request(self.id(), ConsumerGetStatsRequest {})
.await;
.await?;

if let Ok(response::Body::ConsumerGetStatsResponse(data)) = response {
if let response::Body::ConsumerGetStatsResponse(data) = response {
match data.stats.len() {
0 => panic!("Empty stats response from worker"),
1 => {
Expand Down
4 changes: 2 additions & 2 deletions rust/src/router/producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -899,9 +899,9 @@ impl Producer {
.inner()
.channel
.request(self.id(), ProducerGetStatsRequest {})
.await;
.await?;

if let Ok(response::Body::ProducerGetStatsResponse(data)) = response {
if let response::Body::ProducerGetStatsResponse(data) = response {
Ok(data.stats.iter().map(ProducerStat::from_fbs).collect())
} else {
panic!("Wrong message from worker");
Expand Down

0 comments on commit d6373d5

Please sign in to comment.