diff --git a/tonic/src/status.rs b/tonic/src/status.rs index 1e24ebb54..d91fcdf45 100644 --- a/tonic/src/status.rs +++ b/tonic/src/status.rs @@ -333,7 +333,7 @@ impl Status { Err(err) => err, }; - if let Some(status) = find_status_in_cause_chain(&*err) { + if let Some(status) = find_status_in_source_chain(&*err) { return Ok(status); } @@ -538,10 +538,10 @@ impl Status { } } -pub(crate) fn find_status_in_cause_chain(err: &(dyn Error + 'static)) -> Option { - let mut cause = Some(err); +fn find_status_in_source_chain(err: &(dyn Error + 'static)) -> Option { + let mut source = Some(err); - while let Some(err) = cause { + while let Some(err) = source { if let Some(status) = err.downcast_ref::() { return Some(Status { code: status.code, @@ -554,7 +554,7 @@ pub(crate) fn find_status_in_cause_chain(err: &(dyn Error + 'static)) -> Option< }); } - cause = err.source(); + source = err.source(); } None