Skip to content

Commit

Permalink
rename method s/cause/source/ and make private
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Dyas committed Jun 9, 2021
1 parent 445f882 commit cdc139b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tonic/src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -538,10 +538,10 @@ impl Status {
}
}

pub(crate) fn find_status_in_cause_chain(err: &(dyn Error + 'static)) -> Option<Status> {
let mut cause = Some(err);
fn find_status_in_source_chain(err: &(dyn Error + 'static)) -> Option<Status> {
let mut source = Some(err);

while let Some(err) = cause {
while let Some(err) = source {
if let Some(status) = err.downcast_ref::<Status>() {
return Some(Status {
code: status.code,
Expand All @@ -554,7 +554,7 @@ pub(crate) fn find_status_in_cause_chain(err: &(dyn Error + 'static)) -> Option<
});
}

cause = err.source();
source = err.source();
}

None
Expand Down

0 comments on commit cdc139b

Please sign in to comment.