зеркало из https://github.com/golang/pkgsite.git
internal/proxy: fix error reporting
We weren't reporting on NotFound, but the right code is NotFetched, since that is what is returned when proxy fetch is disabled. Change-Id: I554d5186fb4db0346fb9456fe9fc55091066abda Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/320751 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
This commit is contained in:
Родитель
a1d3aaa84a
Коммит
3adcef48f6
|
@ -98,8 +98,11 @@ func (c *Client) WithZipCache() *Client {
|
|||
// endpoint instead.
|
||||
func (c *Client) Info(ctx context.Context, modulePath, requestedVersion string) (_ *VersionInfo, err error) {
|
||||
defer func() {
|
||||
// Don't report NotFetched, because it is the normal result of fetching
|
||||
// an uncached module when fetch is disabled.
|
||||
// Don't report timeouts, because they are relatively frequent and not actionable.
|
||||
wrap := derrors.Wrap
|
||||
if !errors.Is(err, derrors.NotFound) && !errors.Is(err, derrors.ProxyTimedOut) {
|
||||
if !errors.Is(err, derrors.NotFetched) && !errors.Is(err, derrors.ProxyTimedOut) {
|
||||
wrap = derrors.WrapAndReport
|
||||
}
|
||||
wrap(&err, "proxy.Client.Info(%q, %q)", modulePath, requestedVersion)
|
||||
|
|
Загрузка…
Ссылка в новой задаче