Skip to content

Commit a758bc1

Browse files
authored
fix(gensupport): wrap chunk upload err for retries (#2657)
This makes it easier to debug whether and/or how many retries happened before a failure with a chunk upload.
1 parent 719f988 commit a758bc1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

internal/gensupport/resumable.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ func (rx *ResumableUpload) Upload(ctx context.Context) (resp *http.Response, err
171171
if resp != nil && resp.Body != nil {
172172
resp.Body.Close()
173173
}
174+
// If there were retries, indicate this in the error message and wrap the final error.
175+
if rx.attempts > 1 {
176+
return nil, fmt.Errorf("chunk upload failed after %d attempts;, final error: %w", rx.attempts, err)
177+
}
174178
return nil, err
175179
}
176180
// This case is very unlikely but possible only if rx.ChunkRetryDeadline is

0 commit comments

Comments
 (0)