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

Unified Diff: milo/buildsource/buildbot/buildinfo.go

Issue 2977863002: [milo] Refactor all html knowledge out of backends. (Closed)
Patch Set: now with case insensitivity Created 3 years, 5 months 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 | « milo/buildsource/buildbot/builder_test.go ('k') | milo/buildsource/buildbot/datastore.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/buildsource/buildbot/buildinfo.go
diff --git a/milo/buildsource/buildbot/buildinfo.go b/milo/buildsource/buildbot/buildinfo.go
index 3cbf12a4b495f9b2409f70edc67afe7fd3e4fa20..38751d4f3909470faa75bd43fcdbb8d99c891a7f 100644
--- a/milo/buildsource/buildbot/buildinfo.go
+++ b/milo/buildsource/buildbot/buildinfo.go
@@ -29,6 +29,7 @@ import (
"github.com/luci/luci-go/luci_config/common/cfgtypes"
milo "github.com/luci/luci-go/milo/api/proto"
"github.com/luci/luci-go/milo/buildsource/rawpresentation"
+ "github.com/luci/luci-go/milo/common"
"google.golang.org/grpc/codes"
@@ -72,17 +73,19 @@ func (p *BuildInfoProvider) GetBuildInfo(c context.Context, req *milo.BuildInfoR
// Load the BuildBot build from datastore.
build, err := getBuild(c, req.MasterName, req.BuilderName, int(req.BuildNumber))
- switch err {
- case errBuildNotFound:
- return nil, grpcutil.Errf(codes.NotFound, "Build #%d for master %q, builder %q was not found",
- req.BuildNumber, req.MasterName, req.BuilderName)
- case errNotAuth:
- return nil, grpcutil.Unauthenticated
- case nil:
- // continue
- default:
- logging.WithError(err).Errorf(c, "Failed to load build info.")
- return nil, grpcutil.Internal
+ if err != nil {
+ switch common.ErrorTag.In(err) {
+ case common.CodeNotFound:
+ return nil, grpcutil.Errf(codes.NotFound, "Build #%d for master %q, builder %q was not found",
+ req.BuildNumber, req.MasterName, req.BuilderName)
+
+ case common.CodeUnauthorized:
+ return nil, grpcutil.Unauthenticated
+
+ default:
+ logging.WithError(err).Errorf(c, "Failed to load build info.")
+ return nil, grpcutil.Internal
+ }
}
// Create a new LogDog client.
« no previous file with comments | « milo/buildsource/buildbot/builder_test.go ('k') | milo/buildsource/buildbot/datastore.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698