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

Side by Side Diff: go/src/infra/tricium/service/common/common.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, 4 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
« no previous file with comments | « no previous file | go/src/infra/tricium/service/common/common.infra_testing » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // Package common implements common functionality for the Tricium service module s.
6 package common
7
8 import (
9 "fmt"
10 "html/template"
11 "net/http"
12 )
13
14 var basePage = template.Must(template.ParseFiles("templates/base.html"))
15
16 // ShowBasePage executes the base page template
17 func ShowBasePage(w http.ResponseWriter, d interface{}) {
18 executeTemplate(basePage, w, d)
19 }
20
21 func executeTemplate(t *template.Template, w http.ResponseWriter, d interface{}) error {
22 if err := t.Execute(w, d); err != nil {
23 http.Error(w, "Internal server error. We are working on it.", ht tp.StatusInternalServerError)
24 return fmt.Errorf("error executing template: %v", err)
25 }
26 return nil
27 }
OLDNEW
« no previous file with comments | « no previous file | go/src/infra/tricium/service/common/common.infra_testing » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698