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 22, 2021
1 parent a5739a9 commit 8edb9ac
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 @@ -326,7 +326,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 @@ -531,10 +531,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 @@ -547,7 +547,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 8edb9ac

Please sign in to comment.