diff options
author | FuXiaoHei <fuxiaohei@hexiaz.com> | 2014-03-19 20:34:11 +0800 |
---|---|---|
committer | FuXiaoHei <fuxiaohei@hexiaz.com> | 2014-03-19 20:34:11 +0800 |
commit | 78097a2c5a79ec93340db975c23014de2a329572 (patch) | |
tree | 1d9bc1f5422d03eca18269fc1c6b90ebe8910d20 /modules/middleware/context.go | |
parent | 9533b23272097c538e25692ec91c37f4ea6c0b81 (diff) | |
parent | de087c7b4a31cb0643d5432ec9d6b26e208baff2 (diff) |
Merge branch 'master' of https://github.com/gogits/gogs
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 d002d3c2..7eaf6650 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) } |