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

Side by Side Diff: milo/frontend/view_error.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 unified diff | Download patch
« no previous file with comments | « milo/frontend/view_console.go ('k') | milo/frontend/view_frontpage.go » ('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 2017 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file.
4
5 package frontend
6
7 import (
8 "github.com/luci/luci-go/common/errors"
9 "github.com/luci/luci-go/server/router"
10 "github.com/luci/luci-go/server/templates"
11
12 "github.com/luci/luci-go/milo/common"
13 )
14
15 // ErrorHandler renders an error page for the user.
16 func ErrorHandler(c *router.Context, err error) {
17 // TODO(iannucci): tag/extract other information from error, like a link to the
18 // 'container'; i.e. a build may link to its builder, a builder to its
19 // master/bucket, etc.
20
21 code := common.ErrorTag.In(err)
22 if code == common.CodeUnknown {
23 errors.Log(c.Context, err)
24 }
25 status := code.HTTPStatus()
26 c.Writer.WriteHeader(status)
27 templates.MustRender(c.Context, c.Writer, "pages/error.html", templates. Args{
28 "Code": status,
29 "Message": err.Error(),
30 })
31 }
OLDNEW
« no previous file with comments | « milo/frontend/view_console.go ('k') | milo/frontend/view_frontpage.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698