[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
pull/11763/head
6543 5 years ago committed by GitHub
parent fb155b8fa3
commit 99058de553
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      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{

Loading…
Cancel
Save