diff options
author | 6543 <6543@obermui.de> | 2020-06-03 20:17:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-03 14:17:54 -0400 |
commit | ce7510a80f9afdff8ce8694cf0eef180cefb3e15 (patch) | |
tree | da2b136eb72ad188cbb4fe2e20c5d3ac67446971 | |
parent | 19aab7685314a161199c722a4da7995f8ebfcf7b (diff) | |
download | gitea-ce7510a80f9afdff8ce8694cf0eef180cefb3e15.tar.gz gitea-ce7510a80f9afdff8ce8694cf0eef180cefb3e15.zip |
[API] on 500 error only show message if gitea in dev mode (#11641)
* add API specific InternalServerError()
* return 500 error msg only if not Production mode
* rm unnessesary change
-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{ |