Skip to content

Commit 9b148f2

Browse files
committed
return json
1 parent 30d77cd commit 9b148f2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

routers/web/repo/pull.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1585,7 +1585,13 @@ func UpdatePullRequestTarget(ctx *context.Context) {
15851585
if err := pull_service.ChangeTargetBranch(ctx, pr, ctx.Doer, targetBranch); err != nil {
15861586
switch {
15871587
case git_model.IsErrBranchNotExist(err):
1588-
ctx.HTTPError(http.StatusBadRequest)
1588+
errorMessage := ctx.Tr("form.target_branch_not_exist")
1589+
1590+
ctx.Flash.Error(errorMessage)
1591+
ctx.JSON(http.StatusBadRequest, map[string]any{
1592+
"error": err.Error(),
1593+
"user_error": errorMessage,
1594+
})
15891595
case issues_model.IsErrPullRequestAlreadyExists(err):
15901596
err := err.(issues_model.ErrPullRequestAlreadyExists)
15911597

0 commit comments

Comments
 (0)