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/org/setting.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/org/setting.go')
-rw-r--r-- | routers/org/setting.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/routers/org/setting.go b/routers/org/setting.go index 4faed77d0d..937697d07e 100644 --- a/routers/org/setting.go +++ b/routers/org/setting.go @@ -48,7 +48,7 @@ func SettingsPost(ctx *context.Context, form auth.UpdateOrgSettingForm) { if org.LowerName != strings.ToLower(form.Name) { isExist, err := models.IsUserExist(org.ID, form.Name) if err != nil { - ctx.Handle(500, "IsUserExist", err) + ctx.ServerError("IsUserExist", err) return } else if isExist { ctx.Data["OrgName"] = true @@ -59,7 +59,7 @@ func SettingsPost(ctx *context.Context, form auth.UpdateOrgSettingForm) { ctx.Data["OrgName"] = true ctx.RenderWithErr(ctx.Tr("form.illegal_username"), tplSettingsOptions, &form) } else { - ctx.Handle(500, "ChangeUserName", err) + ctx.ServerError("ChangeUserName", err) } return } @@ -80,7 +80,7 @@ func SettingsPost(ctx *context.Context, form auth.UpdateOrgSettingForm) { org.Website = form.Website org.Location = form.Location if err := models.UpdateUser(org); err != nil { - ctx.Handle(500, "UpdateUser", err) + ctx.ServerError("UpdateUser", err) return } log.Trace("Organization setting updated: %s", org.Name) @@ -120,7 +120,7 @@ func SettingsDelete(ctx *context.Context) { if models.IsErrUserNotExist(err) { ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_password"), tplSettingsDelete, nil) } else { - ctx.Handle(500, "UserSignIn", err) + ctx.ServerError("UserSignIn", err) } return } @@ -130,7 +130,7 @@ func SettingsDelete(ctx *context.Context) { ctx.Flash.Error(ctx.Tr("form.org_still_own_repo")) ctx.Redirect(ctx.Org.OrgLink + "/settings/delete") } else { - ctx.Handle(500, "DeleteOrganization", err) + ctx.ServerError("DeleteOrganization", err) } } else { log.Trace("Organization deleted: %s", org.Name) @@ -151,7 +151,7 @@ func Webhooks(ctx *context.Context) { ws, err := models.GetWebhooksByOrgID(ctx.Org.Organization.ID) if err != nil { - ctx.Handle(500, "GetWebhooksByOrgId", err) + ctx.ServerError("GetWebhooksByOrgId", err) return } |