Browse Source

[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
tags/v1.12.0-rc2
6543 3 years ago
parent
commit
99058de553
No account linked to committer's email address
1 changed files with 4 additions and 0 deletions
  1. 4
    0
      modules/context/api.go

+ 4
- 0
modules/context/api.go 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{

Loading…
Cancel
Save