diff options
author | 赵智超 <1012112796@qq.com> | 2020-09-21 04:20:14 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-20 21:20:14 +0100 |
commit | fec152155543e72f2e03885d431642887ce09d69 (patch) | |
tree | 6ba0d440eec9df315c8acf487918036717cf98f0 /routers/api/v1/repo/pull_review.go | |
parent | e7ffc67ad5add193e90219a856935bf643b33fe1 (diff) | |
download | gitea-fec152155543e72f2e03885d431642887ce09d69.tar.gz gitea-fec152155543e72f2e03885d431642887ce09d69.zip |
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>
Diffstat (limited to 'routers/api/v1/repo/pull_review.go')
-rw-r--r-- | routers/api/v1/repo/pull_review.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/routers/api/v1/repo/pull_review.go b/routers/api/v1/repo/pull_review.go index 3f2cb011d8..86c084acd7 100644 --- a/routers/api/v1/repo/pull_review.go +++ b/routers/api/v1/repo/pull_review.go @@ -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 } } |