summaryrefslogtreecommitdiffstats
path: root/modules/middleware/context.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/middleware/context.go')
-rw-r--r--modules/middleware/context.go7
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)
}