Skip to content

Commit

Permalink
set cancelled status if underlying hyper error is due to cancelled
Browse files Browse the repository at this point in the history
  • Loading branch information
nrxus committed Mar 29, 2024
1 parent eeb3268 commit 9a6e97d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tonic/src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,10 @@ impl Status {
return Some(Status::unavailable(err.to_string()));
}

if err.is_canceled() {
return Some(Status::cancelled(err.to_string()));
}

if let Some(h2_err) = err.source().and_then(|e| e.downcast_ref::<h2::Error>()) {
let code = Status::code_from_h2(h2_err);
let status = Self::new(code, format!("h2 protocol error: {}", err));
Expand Down

0 comments on commit 9a6e97d

Please sign in to comment.