diff options
author | 6543 <6543@obermui.de> | 2020-06-04 04:24:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-03 22:24:47 -0400 |
commit | 99058de553a85c5c5ee9b889c4698c401233a647 (patch) | |
tree | 14d9b9843877d7b5105dfe5be6ac3e0ab3081224 /modules/context | |
parent | fb155b8fa3d7587b169047301c8329460daab5ae (diff) | |
download | gitea-99058de553a85c5c5ee9b889c4698c401233a647.tar.gz gitea-99058de553a85c5c5ee9b889c4698c401233a647.zip |
[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
Diffstat (limited to 'modules/context')
-rw-r--r-- | modules/context/api.go | 4 |
1 files changed, 4 insertions, 0 deletions
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{ |