mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-07 14:43:35 +02:00
fix(api): return 409 message instead of empty JSON for wrong commit id (#37572)
## Issue Closes #37217 The error string was getting lost while returning due to `ctx.JSON()` which cannot serialize the `error` object. ## Fix Use `ctx.APIError()` to return proper error messages back to the client.
This commit is contained in:
parent
630258410d
commit
19f01691d5
@ -996,7 +996,7 @@ func MergePullRequest(ctx *context.APIContext) {
|
||||
return
|
||||
}
|
||||
if strings.Contains(err.Error(), "Wrong commit ID") {
|
||||
ctx.JSON(http.StatusConflict, err)
|
||||
ctx.APIError(http.StatusConflict, err)
|
||||
return
|
||||
}
|
||||
ctx.APIErrorInternal(err)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user