diff options
author | Morgan Bazalgette <git@howl.moe> | 2018-01-10 22:34:17 +0100 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2018-01-10 23:34:17 +0200 |
commit | 65861900cda3bb6d9e2aa80b808b0000383c04b3 (patch) | |
tree | 8569d93b6ef092b30b35a4d4da906c6b6950e2ee /routers/repo/issue_label.go | |
parent | 45c264f681e3f7e1a22a191029836a690959aac3 (diff) | |
download | gitea-65861900cda3bb6d9e2aa80b808b0000383c04b3.tar.gz gitea-65861900cda3bb6d9e2aa80b808b0000383c04b3.zip |
Handle refactor (#3339)
* Replace all ctx.Handle with ctx.ServerError or ctx.NotFound
* Change Handle(403) to NotFound, avoid using macaron's NotFound
Diffstat (limited to 'routers/repo/issue_label.go')
-rw-r--r-- | routers/repo/issue_label.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/routers/repo/issue_label.go b/routers/repo/issue_label.go index f8a955ba6d..a197256be8 100644 --- a/routers/repo/issue_label.go +++ b/routers/repo/issue_label.go @@ -48,7 +48,7 @@ func InitializeLabels(ctx *context.Context, form auth.InitializeLabelsForm) { } } if err := models.NewLabels(labels...); err != nil { - ctx.Handle(500, "NewLabels", err) + ctx.ServerError("NewLabels", err) return } ctx.Redirect(ctx.Repo.RepoLink + "/labels") @@ -58,7 +58,7 @@ func InitializeLabels(ctx *context.Context, form auth.InitializeLabelsForm) { func RetrieveLabels(ctx *context.Context) { labels, err := models.GetLabelsByRepoID(ctx.Repo.Repository.ID, ctx.Query("sort")) if err != nil { - ctx.Handle(500, "RetrieveLabels.GetLabels", err) + ctx.ServerError("RetrieveLabels.GetLabels", err) return } for _, l := range labels { @@ -86,7 +86,7 @@ func NewLabel(ctx *context.Context, form auth.CreateLabelForm) { Color: form.Color, } if err := models.NewLabel(l); err != nil { - ctx.Handle(500, "NewLabel", err) + ctx.ServerError("NewLabel", err) return } ctx.Redirect(ctx.Repo.RepoLink + "/labels") @@ -100,7 +100,7 @@ func UpdateLabel(ctx *context.Context, form auth.CreateLabelForm) { case models.IsErrLabelNotExist(err): ctx.Error(404) default: - ctx.Handle(500, "UpdateLabel", err) + ctx.ServerError("UpdateLabel", err) } return } @@ -108,7 +108,7 @@ func UpdateLabel(ctx *context.Context, form auth.CreateLabelForm) { l.Name = form.Title l.Color = form.Color if err := models.UpdateLabel(l); err != nil { - ctx.Handle(500, "UpdateLabel", err) + ctx.ServerError("UpdateLabel", err) return } ctx.Redirect(ctx.Repo.RepoLink + "/labels") @@ -139,7 +139,7 @@ func UpdateIssueLabel(ctx *context.Context) { case "clear": for _, issue := range issues { if err := issue.ClearLabels(ctx.User); err != nil { - ctx.Handle(500, "ClearLabels", err) + ctx.ServerError("ClearLabels", err) return } } @@ -149,7 +149,7 @@ func UpdateIssueLabel(ctx *context.Context) { if models.IsErrLabelNotExist(err) { ctx.Error(404, "GetLabelByID") } else { - ctx.Handle(500, "GetLabelByID", err) + ctx.ServerError("GetLabelByID", err) } return } @@ -168,14 +168,14 @@ func UpdateIssueLabel(ctx *context.Context) { if action == "attach" { for _, issue := range issues { if err = issue.AddLabel(ctx.User, label); err != nil { - ctx.Handle(500, "AddLabel", err) + ctx.ServerError("AddLabel", err) return } } } else { for _, issue := range issues { if err = issue.RemoveLabel(ctx.User, label); err != nil { - ctx.Handle(500, "RemoveLabel", err) + ctx.ServerError("RemoveLabel", err) return } } |