mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-24 21:53:39 +09:00
refactor: make git http respond error message (#39390)
* Refactor some bad smells in legacy code * Fix #37999: instead of creating an empty (undesired) wiki page, just tell users to create a wiki page first
This commit is contained in:
@@ -68,7 +68,7 @@ func renderPanicErrorPage(w http.ResponseWriter, req *http.Request, recovered an
|
||||
// This recovery handler could be called without Gitea's web context, so we shouldn't touch that context too much.
|
||||
// Otherwise, the 500-page may cause new panics, eg: cache.GetContextWithData, it makes the developer&users couldn't find the original panic.
|
||||
user, _ := ctxData[middleware.ContextDataKeySignedUser].(*user_model.User)
|
||||
if !setting.IsProd || (user != nil && user.IsAdmin) {
|
||||
if !setting.IsProd || setting.IsInTesting || (user != nil && user.IsAdmin) {
|
||||
plainMsg = "PANIC: " + combinedErr.Error()
|
||||
ctxData["ErrorMsg"] = plainMsg
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user