Skip to content

Commit b97d900

Browse files
Include latest error in AllAttemptsErrored
$ git grep AllAttemptsErrored src/client.rs: return Err(Error::AllAttemptsErrored(errors)); src/client.rs: return Err(Error::AllAttemptsErrored(errors)); fixed here src/raw_client.rs: Err(Error::AllAttemptsErrored(errors)) already correctly collected src/types.rs: AllAttemptsErrored(Vec<Error>), src/types.rs: Error::AllAttemptsErrored(errors) => { consumers This also reorders the warning before the error: warn!("re-creating client failed with {}, retry: {}/{}", e, failed_attempts, $self.config.retry()); warn!("re-creating client failed after {} attempts", failed_attempts); Closes #186
1 parent 5d7be37 commit b97d900

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/client.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ macro_rules! impl_inner_call {
5555
Err(e) => {
5656
let failed_attempts = errors.len() + 1;
5757

58+
warn!("call '{}' failed with {}, retry: {}/{}", stringify!($name), e, failed_attempts, $self.config.retry());
59+
60+
errors.push(e);
61+
5862
if retries_exhausted(failed_attempts, $self.config.retry()) {
5963
warn!("call '{}' failed after {} attempts", stringify!($name), failed_attempts);
6064
return Err(Error::AllAttemptsErrored(errors));
6165
}
6266

63-
warn!("call '{}' failed with {}, retry: {}/{}", stringify!($name), e, failed_attempts, $self.config.retry());
64-
65-
errors.push(e);
66-
6767
// Only one thread will try to recreate the client getting the write lock,
6868
// other eventual threads will get Err and will block at the beginning of
6969
// previous loop when trying to read()
@@ -79,14 +79,14 @@ macro_rules! impl_inner_call {
7979
Err(e) => {
8080
let failed_attempts = errors.len() + 1;
8181

82+
warn!("re-creating client failed with {}, retry: {}/{}", e, failed_attempts, $self.config.retry());
83+
84+
errors.push(e);
85+
8286
if retries_exhausted(failed_attempts, $self.config.retry()) {
8387
warn!("re-creating client failed after {} attempts", failed_attempts);
8488
return Err(Error::AllAttemptsErrored(errors));
8589
}
86-
87-
warn!("re-creating client failed with {}, retry: {}/{}", e, failed_attempts, $self.config.retry());
88-
89-
errors.push(e);
9090
}
9191
}
9292
}

0 commit comments

Comments
 (0)