Skip to content

Commit a1e1efa

Browse files
committed
switch the if statement
1 parent 27bc461 commit a1e1efa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

retry.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ func Do(retryableFunc RetryableFunc, opts ...Option) error {
113113
select {
114114
case <-config.timer.After(delay(config, n, err)):
115115
case <-config.context.Done():
116-
if !config.wrapContextErrorWithLastError {
117-
return config.context.Err()
116+
if config.wrapContextErrorWithLastError {
117+
return fmt.Errorf("%w: %w", config.context.Err(), lastErr)
118118
}
119-
return fmt.Errorf("%w: %w", config.context.Err(), lastErr)
119+
return config.context.Err()
120120
}
121121
}
122122

0 commit comments

Comments
 (0)