Skip to content

Commit 2ca13d8

Browse files
committed
Join errors when retry token is unavailable
If we fail to acquire a retry token, we are currently discarding the original error. According to the Retry Behaviour reference guide, we are expected to return the actual response (error) in this situation. With these changes, we now return the joined error, which allows callers to inspect and match on the error that caused the request to fail.
1 parent 461e9c7 commit 2ca13d8

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"id": "3723ba75-d027-4e70-93f3-6202b10d6edd",
3+
"type": "bugfix",
4+
"description": "Include original error when retry token unavailable",
5+
"collapse": false,
6+
"modules": [
7+
"aws"
8+
]
9+
}

aws/retry/middleware.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ func (r *Attempt) handleAttempt(
260260
// Get a retry token that will be released after the
261261
releaseRetryToken, retryTokenErr := r.retryer.GetRetryToken(ctx, err)
262262
if retryTokenErr != nil {
263-
return out, attemptResult, nopRelease, retryTokenErr
263+
return out, attemptResult, nopRelease, errors.Join(err, retryTokenErr)
264264
}
265265

266266
//------------------------------

0 commit comments

Comments
 (0)