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/release.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/release.go')
-rw-r--r-- | routers/api/v1/repo/release.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/routers/api/v1/repo/release.go b/routers/api/v1/repo/release.go index 752b5c76e0..e7cc1e8671 100644 --- a/routers/api/v1/repo/release.go +++ b/routers/api/v1/repo/release.go @@ -151,7 +151,7 @@ func CreateRelease(ctx *context.APIContext, form api.CreateReleaseOption) { rel, err := models.GetRelease(ctx.Repo.Repository.ID, form.TagName) if err != nil { if !models.IsErrReleaseNotExist(err) { - ctx.ServerError("GetRelease", err) + ctx.Error(http.StatusInternalServerError, "GetRelease", err) return } // If target is not provided use default branch @@ -195,7 +195,7 @@ func CreateRelease(ctx *context.APIContext, form api.CreateReleaseOption) { rel.Publisher = ctx.User if err = releaseservice.UpdateReleaseOrCreatReleaseFromTag(ctx.User, ctx.Repo.GitRepo, rel, nil, true); err != nil { - ctx.ServerError("UpdateReleaseOrCreatReleaseFromTag", err) + ctx.Error(http.StatusInternalServerError, "UpdateReleaseOrCreatReleaseFromTag", err) return } } |