diff options
author | Unknown <joe2010xtmf@163.com> | 2014-03-19 04:48:45 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-03-19 04:48:45 -0400 |
commit | bd9d90d8c48965e4e78fd56147c465ba80ec5ed5 (patch) | |
tree | e523e7db6eec1af33bb920680d24bacd64d8c588 /modules/middleware/context.go | |
parent | b192b70aecbe3b91affd9d9396669ed000a936d6 (diff) | |
download | gitea-bd9d90d8c48965e4e78fd56147c465ba80ec5ed5.tar.gz gitea-bd9d90d8c48965e4e78fd56147c465ba80ec5ed5.zip |
Add some log
Diffstat (limited to 'modules/middleware/context.go')
-rw-r--r-- | modules/middleware/context.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/middleware/context.go b/modules/middleware/context.go index d002d3c24e..7eaf665005 100644 --- a/modules/middleware/context.go +++ b/modules/middleware/context.go @@ -67,8 +67,13 @@ func (ctx *Context) RenderWithErr(msg, tpl string, form auth.Form) { // Handle handles and logs error by given status. func (ctx *Context) Handle(status int, title string, err error) { - ctx.Data["ErrorMsg"] = err log.Error("%s: %v", title, err) + if martini.Dev == martini.Prod { + ctx.Render.HTML(500, "status/500", ctx.Data) + return + } + + ctx.Data["ErrorMsg"] = err ctx.Render.HTML(status, fmt.Sprintf("status/%d", status), ctx.Data) } |