From 99058de553a85c5c5ee9b889c4698c401233a647 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Thu, 4 Jun 2020 04:24:47 +0200 Subject: [PATCH] [API] on 500 error only show message if gitea in dev mode (#11641) (#11753) * add API specific InternalServerError() * return 500 error msg only if not Production mode * rm unnessesary change --- modules/context/api.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/context/api.go b/modules/context/api.go index 963c5c14f3..5d91ac49a3 100644 --- a/modules/context/api.go +++ b/modules/context/api.go @@ -77,6 +77,10 @@ func (ctx *APIContext) Error(status int, title string, obj interface{}) { if status == http.StatusInternalServerError { log.ErrorWithSkip(1, "%s: %s", title, message) + + if macaron.Env == macaron.PROD { + message = "" + } } ctx.JSON(status, APIError{