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

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

Issue 2856273004: Milo: Increase test coverage for appengine/buildbot (Closed)
Patch Set: review Created 3 years, 7 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/appengine/buildbot/grpc_test.go ('k') | milo/appengine/buildbot/html_data.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/appengine/buildbot/html.go
diff --git a/milo/appengine/buildbot/html.go b/milo/appengine/buildbot/html.go
index 3b1d2b84f08b7ae8d30bc9fedef0563269a0725d..c5f63f7b06f82793d3206a787887d5984cca285e 100644
--- a/milo/appengine/buildbot/html.go
+++ b/milo/appengine/buildbot/html.go
@@ -38,7 +38,7 @@ func BuildHandler(c *router.Context) {
return
}
- result, err := build(c.Context, master, builder, num)
+ result, err := Build(c.Context, master, builder, num)
if err != nil {
var code int
switch err {
@@ -83,13 +83,18 @@ func BuilderHandler(c *router.Context) {
cursor := c.Request.FormValue("cursor")
result, err := builderImpl(c.Context, master, builder, limit, cursor)
- if err != nil {
+ _, notFound := err.(errBuilderNotFound)
+ switch {
+ case err == nil:
+ templates.MustRender(c.Context, c.Writer, "pages/builder.html", templates.Args{
+ "Builder": result,
+ })
+ case err == errNotAuth:
+ common.ErrorPage(c, http.StatusUnauthorized, err.Error())
+ case notFound:
+ common.ErrorPage(c, http.StatusNotFound, err.Error())
+ default: // err != nil
common.ErrorPage(c, http.StatusInternalServerError, err.Error())
- return
}
-
- // Render into the template
- templates.MustRender(c.Context, c.Writer, "pages/builder.html", templates.Args{
- "Builder": result,
- })
+ return
}
« no previous file with comments | « milo/appengine/buildbot/grpc_test.go ('k') | milo/appengine/buildbot/html_data.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698