[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
release/v1.15
6543 2020-06-03 20:17:54 +02:00 committed by GitHub
parent 19aab76853
commit ce7510a80f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -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{