Provide better panic handling (#5902)

This PR gitea'ises the macaron.Recovery() handler meaning that in
the event of panic we get proper gitea 500 pages and the stacktrace
is logged with the gitea logger.

Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
zeripath 2019-01-30 22:00:00 +00:00 committed by techknowlogick
parent 0f295ababa
commit ca00ca8ee4
4 changed files with 118 additions and 2 deletions

View file

@ -136,6 +136,9 @@ func NewMacaron() *macaron.Macaron {
DisableDebug: !setting.EnablePprof,
}))
m.Use(context.Contexter())
// OK we are now set-up enough to allow us to create a nicer recovery than
// the default macaron recovery
m.Use(context.Recovery())
m.SetAutoHead(true)
return m
}