Skip to content

Commit 9d4d4aa

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 Closes #186
1 parent 5d7be37 commit 9d4d4aa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/client.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ macro_rules! impl_inner_call {
5454
},
5555
Err(e) => {
5656
let failed_attempts = errors.len() + 1;
57+
errors.push(e);
58+
let e = errors.last().unwrap();
5759

5860
if retries_exhausted(failed_attempts, $self.config.retry()) {
5961
warn!("call '{}' failed after {} attempts", stringify!($name), failed_attempts);
@@ -62,8 +64,6 @@ macro_rules! impl_inner_call {
6264

6365
warn!("call '{}' failed with {}, retry: {}/{}", stringify!($name), e, failed_attempts, $self.config.retry());
6466

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()
@@ -78,15 +78,15 @@ macro_rules! impl_inner_call {
7878
},
7979
Err(e) => {
8080
let failed_attempts = errors.len() + 1;
81+
errors.push(e);
82+
let e = errors.last().unwrap();
8183

8284
if retries_exhausted(failed_attempts, $self.config.retry()) {
8385
warn!("re-creating client failed after {} attempts", failed_attempts);
8486
return Err(Error::AllAttemptsErrored(errors));
8587
}
8688

8789
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)