Skip to content

Commit

Permalink
fix(gensupport): wrap chunk upload err for retries (#2657)
Browse files Browse the repository at this point in the history
This makes it easier to debug whether and/or how many retries happened before a failure with a chunk upload.
  • Loading branch information
tritone committed Jun 28, 2024
1 parent 719f988 commit a758bc1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/gensupport/resumable.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ func (rx *ResumableUpload) Upload(ctx context.Context) (resp *http.Response, err
if resp != nil && resp.Body != nil {
resp.Body.Close()
}
// If there were retries, indicate this in the error message and wrap the final error.
if rx.attempts > 1 {
return nil, fmt.Errorf("chunk upload failed after %d attempts;, final error: %w", rx.attempts, err)
}
return nil, err
}
// This case is very unlikely but possible only if rx.ChunkRetryDeadline is
Expand Down

0 comments on commit a758bc1

Please sign in to comment.