Skip to content

Commit 094e65a

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

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

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)