fix(storage): retry url.Error and net.OpErrors when they wrap an io.E… · googleapis/google-cloud-go@080f6b0

Original file line numberDiff line numberDiff line change

@@ -174,9 +174,9 @@ func ShouldRetry(err error) bool {

174174

// We don't want to retry io.EOF errors, since these can indicate normal

175175

// functioning terminations such as internally in the case of Reader and

176176

// externally in the case of iterator methods. However, the linked bug

177-

// requires us to retry EOFs that it causes. We can distinguish

178-

// EOFs caused by the bug because they are not wrapped correctly.

179-

if !errors.Is(err, io.EOF) && strings.Contains(err.Error(), "EOF") {

177+

// requires us to retry the EOFs that it causes, which should be wrapped

178+

// in net or url errors.

179+

if errors.Is(err, io.EOF) {

180180

return true

181181

}

182182

case *net.DNSError: