1
0
Fork 0
forked from forgejo/forgejo

Add some log

This commit is contained in:
Unknown 2014-03-19 04:48:45 -04:00
parent b192b70aec
commit bd9d90d8c4
6 changed files with 22 additions and 4 deletions

View file

@ -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)
}