@@ -132,7 +132,7 @@ func DoWithData[T any](retryableFunc RetryableFuncWithData[T], opts ...Option) (
132
132
opt (config )
133
133
}
134
134
135
- if err := config . context .Err ( ); err != nil {
135
+ if err := context .Cause ( config . context ); err != nil {
136
136
return emptyT , err
137
137
}
138
138
@@ -161,9 +161,9 @@ func DoWithData[T any](retryableFunc RetryableFuncWithData[T], opts ...Option) (
161
161
case <- config .timer .After (delay (config , n , err )):
162
162
case <- config .context .Done ():
163
163
if config .wrapContextErrorWithLastError {
164
- return emptyT , Error {config . context .Err ( ), lastErr }
164
+ return emptyT , Error {context .Cause ( config . context ), lastErr }
165
165
}
166
- return emptyT , config . context .Err ( )
166
+ return emptyT , context .Cause ( config . context )
167
167
}
168
168
}
169
169
}
@@ -207,10 +207,10 @@ func DoWithData[T any](retryableFunc RetryableFuncWithData[T], opts ...Option) (
207
207
case <- config .timer .After (delay (config , n , err )):
208
208
case <- config .context .Done ():
209
209
if config .lastErrorOnly {
210
- return emptyT , config . context .Err ( )
210
+ return emptyT , context .Cause ( config . context )
211
211
}
212
212
213
- return emptyT , append (errorLog , config . context .Err ( ))
213
+ return emptyT , append (errorLog , context .Cause ( config . context ))
214
214
}
215
215
216
216
shouldRetry = shouldRetry && n < config .attempts
0 commit comments