client-go: wrap error from previous attempt to provide more context

Kubernetes-commit: 868b5a31d382b325f49e1b831e6b094282d50cc7
This commit is contained in:
Abu Kashem
2022-03-14 18:57:56 -04:00
committed by Kubernetes Publisher
parent ed2838156a
commit 7c9347d386
4 changed files with 474 additions and 4 deletions

View File

@@ -620,7 +620,7 @@ func (r *Request) Watch(ctx context.Context) (watch.Interface, error) {
}
if err := r.retry.Before(ctx, r); err != nil {
return nil, err
return nil, r.retry.WrapPreviousError(err)
}
resp, err := client.Do(req)
@@ -655,7 +655,7 @@ func (r *Request) Watch(ctx context.Context) (watch.Interface, error) {
// we need to return the error object from that.
err = transformErr
}
return nil, err
return nil, r.retry.WrapPreviousError(err)
}
}
}
@@ -865,7 +865,7 @@ func (r *Request) request(ctx context.Context, fn func(*http.Request, *http.Resp
}
if err := r.retry.Before(ctx, r); err != nil {
return err
return r.retry.WrapPreviousError(err)
}
resp, err := client.Do(req)
updateURLMetrics(ctx, r, resp, err)
@@ -895,7 +895,7 @@ func (r *Request) request(ctx context.Context, fn func(*http.Request, *http.Resp
return true
}()
if done {
return err
return r.retry.WrapPreviousError(err)
}
}
}