mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-25 11:22:16 +00:00
Not using "ctx.ServerError" in api (#12907)
This function will render a whole html page which is not useful for API. Signed-off-by: a1012112796 <1012112796@qq.com>
This commit is contained in:
parent
e7ffc67ad5
commit
fec1521555
10 changed files with 26 additions and 28 deletions
|
@ -318,14 +318,14 @@ func CreatePullReview(ctx *context.APIContext, opts api.CreatePullReviewOptions)
|
|||
if opts.CommitID == "" {
|
||||
gitRepo, err := git.OpenRepository(pr.Issue.Repo.RepoPath())
|
||||
if err != nil {
|
||||
ctx.ServerError("git.OpenRepository", err)
|
||||
ctx.Error(http.StatusInternalServerError, "git.OpenRepository", err)
|
||||
return
|
||||
}
|
||||
defer gitRepo.Close()
|
||||
|
||||
headCommitID, err := gitRepo.GetRefCommitID(pr.GetGitRefName())
|
||||
if err != nil {
|
||||
ctx.ServerError("GetRefCommitID", err)
|
||||
ctx.Error(http.StatusInternalServerError, "GetRefCommitID", err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -350,7 +350,7 @@ func CreatePullReview(ctx *context.APIContext, opts api.CreatePullReviewOptions)
|
|||
0, // no reply
|
||||
opts.CommitID,
|
||||
); err != nil {
|
||||
ctx.ServerError("CreateCodeComment", err)
|
||||
ctx.Error(http.StatusInternalServerError, "CreateCodeComment", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue