mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-24 18:10:52 +00:00
Handle push rejection message in Merge & Web Editor (#10373)
* Handle push rejection message in Merge * placate golangci-lint * Fix sanitize, adjust message handling * oops * Oops * Handle push-rejection in webeditor CRUD too * Apply suggestions from code review Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
parent
2ed9ead6de
commit
089ccb0c80
8 changed files with 134 additions and 15 deletions
|
@ -684,6 +684,14 @@ func MergePullRequest(ctx *context.APIContext, form auth.MergePullRequestForm) {
|
|||
} else if models.IsErrMergePushOutOfDate(err) {
|
||||
ctx.Error(http.StatusConflict, "Merge", "merge push out of date")
|
||||
return
|
||||
} else if models.IsErrPushRejected(err) {
|
||||
errPushRej := err.(models.ErrPushRejected)
|
||||
if len(errPushRej.Message) == 0 {
|
||||
ctx.Error(http.StatusConflict, "Merge", "PushRejected without remote error message")
|
||||
return
|
||||
}
|
||||
ctx.Error(http.StatusConflict, "Merge", "PushRejected with remote message: "+errPushRej.Message)
|
||||
return
|
||||
}
|
||||
ctx.Error(http.StatusInternalServerError, "Merge", err)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue