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:
wxiaoguang
2026-09-23 08:51:58 +00:00
committed by GitHub
parent 6146a4869e
commit 08149f9bec
5 changed files with 93 additions and 102 deletions
+1 -1
View File
@@ -155,7 +155,7 @@ func (ctx *Context) notFoundInternal(skip int, logMsg string, logErr error) {
func (ctx *Context) buildUserErrorMessage(msg string, err error) (userErrorMsg string) {
// it's safe to show internal error to admin users, and it helps
if !setting.IsProd || (ctx.Doer != nil && ctx.Doer.IsAdmin) {
if !setting.IsProd || setting.IsInTesting || (ctx.Doer != nil && ctx.Doer.IsAdmin) {
userErrorMsg = msg
if err != nil {
userErrorMsg += ", error: " + err.Error()