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

Side by Side Diff: go/src/infra/tricium/service/gerrit-reporter/handlers.go

Issue 2149853003: Adds checking of template error (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Package handlers implements HTTP handlers for the gerrit-reporter module. 5 // Package handlers implements HTTP handlers for the gerrit-reporter module.
6 package handlers 6 package handlers
7 7
8 import ( 8 import (
9 "html/template" 9 "html/template"
10 "net/http" 10 "net/http"
11 ) 11 )
12 12
13 func init() { 13 func init() {
14 http.HandleFunc("/gerrit-reporter/status", statusPageHandler) 14 http.HandleFunc("/gerrit-reporter/status", statusPageHandler)
15 http.HandleFunc("/gerrit-reporter/queue-handler", queueHandler) 15 http.HandleFunc("/gerrit-reporter/queue-handler", queueHandler)
16 } 16 }
17 17
18 var basePage = template.Must(template.ParseFiles("templates/base.html")) 18 var basePage = template.Must(template.ParseFiles("templates/base.html"))
19 19
20 func statusPageHandler(w http.ResponseWriter, r *http.Request) { 20 func statusPageHandler(w http.ResponseWriter, r *http.Request) {
21 // TODO(emso): Add Gerrit reporter stats 21 // TODO(emso): Add Gerrit reporter stats
22 data := map[string]interface{}{ 22 data := map[string]interface{}{
23 "Msg": "Status of the Gerrit Reporter ...", 23 "Msg": "Status of the Gerrit Reporter ...",
24 } 24 }
25 » basePage.Execute(w, data) 25 » if e := basePage.Execute(w, data); e != nil {
26 » » http.Error(w, e.Error(), http.StatusInternalServerError)
27 » » return
28 » }
26 } 29 }
27 30
28 func queueHandler(w http.ResponseWriter, r *http.Request) { 31 func queueHandler(w http.ResponseWriter, r *http.Request) {
29 // TODO(emso): Process request and report event to Gerrit 32 // TODO(emso): Process request and report event to Gerrit
30 } 33 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698