pkg/download: return 404 on list/latest (#1299)

This commit is contained in:
Marwan Sulaiman
2019-07-08 17:31:42 -04:00
committed by Aaron Schlesinger
parent 7fa1e00775
commit e4534a20db
2 changed files with 10 additions and 1 deletions
+2
View File
@@ -1,5 +1,7 @@
module github.com/gomods/athens
go 1.12
require (
cloud.google.com/go v0.26.0
contrib.go.opencensus.io/exporter/stackdriver v0.6.0
+8 -1
View File
@@ -66,7 +66,14 @@ func (l *vcsLister) List(ctx context.Context, mod string) (*storage.RevInfo, []s
err = cmd.Run()
if err != nil {
err = fmt.Errorf("%v: %s", err, stderr)
return nil, nil, errors.E(op, err)
// as of now, we can't recognize between a true NotFound
// and an unexpected error, so we choose the more
// hopeful path of NotFound. This way the Go command
// will not log en error and we still get to log
// what happened here if someone wants to dig in more.
// Once, https://github.com/golang/go/issues/30134 is
// resolved, we can hopefully differentiate.
return nil, nil, errors.E(op, err, errors.KindNotFound)
}
var lr listResp