Skip to content

Commit a3a7ead

Browse files
committed
feat: 1243 returns both resetErr and the request's err on retries.Halt
1 parent a3aa179 commit a3a7ead

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### New Features and Improvements
66

77
### Bug Fixes
8+
fix: 1243 returns both resetErr and the request's err on retries.Halt
89

910
### documentation
1011

httpclient/api_client.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,9 @@ func (c *ApiClient) handleError(ctx context.Context, err error, body common.Requ
259259
return nil, retries.Halt(err)
260260
}
261261
if resetErr := body.Reset(); resetErr != nil {
262-
return nil, retries.Halt(resetErr)
262+
return nil, retries.Halt(
263+
fmt.Errorf("%w, request error: %w", resetErr, err),
264+
)
263265
}
264266
return nil, retries.Continue(err)
265267
}

httpclient/api_client_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,7 @@ func TestCannotRetryArbitraryReader(t *testing.T) {
601601
err := client.Do(context.Background(), "POST", "/a",
602602
WithRequestData(customReader{}))
603603
require.ErrorContains(t, err, "cannot reset reader of type httpclient.customReader")
604+
require.ErrorContains(t, err, "http 429")
604605
}
605606

606607
func TestRetryGetRequest(t *testing.T) {

0 commit comments

Comments
 (0)