Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Unified Diff: milo/appengine/buildbot/build.go

Issue 2525493002: Milo: Add themed page for errors (Closed)
Patch Set: Review Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | milo/appengine/buildbot/build_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/appengine/buildbot/build.go
diff --git a/milo/appengine/buildbot/build.go b/milo/appengine/buildbot/build.go
index da6149f1ba18dbb590abe2867e611399511bdffb..153b7c9e2cc60ac5ccc7a5e59aa80069b3e3c6b5 100644
--- a/milo/appengine/buildbot/build.go
+++ b/milo/appengine/buildbot/build.go
@@ -18,7 +18,6 @@ import (
"github.com/luci/luci-go/common/data/stringset"
"github.com/luci/luci-go/common/logging"
"github.com/luci/luci-go/milo/api/resp"
- "github.com/luci/luci-go/milo/appengine/settings"
"github.com/luci/luci-go/milo/common/miloerror"
"golang.org/x/net/context"
)
@@ -29,6 +28,7 @@ var errBuildNotFound = miloerror.Error{
}
// getBuild fetches a buildbot build from the datastore and checks ACLs.
+// The return code matches the master responses.
func getBuild(c context.Context, master, builder string, buildNum int) (*buildbotBuild, error) {
result := &buildbotBuild{
Master: master,
@@ -37,23 +37,11 @@ func getBuild(c context.Context, master, builder string, buildNum int) (*buildbo
}
err := ds.Get(c, result)
- switch {
- case err == ds.ErrNoSuchEntity:
- return nil, errBuildNotFound
- case err != nil:
- return nil, err
+ err = checkAccess(c, err, result.Internal)
+ if err == errMasterNotFound {
+ err = errBuildNotFound
}
- if result.Internal {
- allowed, err := settings.IsAllowedInternal(c)
- if err != nil {
- return nil, err
- }
- if !allowed {
- return nil, errBuildNotFound
- }
- }
-
- return result, nil
+ return result, err
}
// result2Status translates a buildbot result integer into a resp.Status.
« no previous file with comments | « no previous file | milo/appengine/buildbot/build_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698