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

Unified Diff: go/src/infra/tricium/service/gerrit-poller/handlers.go

Issue 2149853003: Adds checking of template error (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Adds infra testing expectation Created 4 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
Index: go/src/infra/tricium/service/gerrit-poller/handlers.go
diff --git a/go/src/infra/tricium/service/gerrit-poller/handlers.go b/go/src/infra/tricium/service/gerrit-poller/handlers.go
index e9b14a09cd5b68052fdae72d2e05a2832d423f71..7e3a01f199fee9978564f49b537d9b8548a33979 100644
--- a/go/src/infra/tricium/service/gerrit-poller/handlers.go
+++ b/go/src/infra/tricium/service/gerrit-poller/handlers.go
@@ -6,11 +6,12 @@
package handlers
import (
- "html/template"
"net/http"
"google.golang.org/appengine"
"google.golang.org/appengine/taskqueue"
+
+ "infra/tricium/service/common"
)
func init() {
@@ -18,14 +19,12 @@ func init() {
http.HandleFunc("/gerrit-poller/poll", pollHandler)
}
-var basePage = template.Must(template.ParseFiles("templates/base.html"))
-
func statusPageHandler(w http.ResponseWriter, r *http.Request) {
// TODO(emso): Add Gerrit poller stats
- data := map[string]interface{}{
+ d := map[string]interface{}{
"Msg": "Status of the Gerrit Poller ...",
}
- basePage.Execute(w, data)
+ common.ShowBasePage(w, d)
}
func pollHandler(w http.ResponseWriter, r *http.Request) {
@@ -35,8 +34,8 @@ func pollHandler(w http.ResponseWriter, r *http.Request) {
// Enqueue workflow event task.
t := taskqueue.NewPOSTTask("/workflow-launcher/queue-handler", map[string][]string{"name": {"Analysis Request"}})
- if _, err := taskqueue.Add(ctx, t, "workflow-launcher-queue"); err != nil {
- http.Error(w, err.Error(), http.StatusInternalServerError)
+ if _, e := taskqueue.Add(ctx, t, "workflow-launcher-queue"); e != nil {
+ http.Error(w, e.Error(), http.StatusInternalServerError)
return
}
}
« no previous file with comments | « go/src/infra/tricium/service/default/handlers.go ('k') | go/src/infra/tricium/service/gerrit-reporter/handlers.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698