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/branch.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/branch.go')
-rw-r--r-- | routers/repo/branch.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/routers/repo/branch.go b/routers/repo/branch.go index c56e8e86b2..7b1e2a8bbe 100644 --- a/routers/repo/branch.go +++ b/routers/repo/branch.go @@ -136,7 +136,7 @@ func deleteBranch(ctx *context.Context, branchName string) error { func loadBranches(ctx *context.Context) []*Branch { rawBranches, err := ctx.Repo.Repository.GetBranches() if err != nil { - ctx.Handle(500, "GetBranches", err) + ctx.ServerError("GetBranches", err) return nil } @@ -144,13 +144,13 @@ func loadBranches(ctx *context.Context) []*Branch { for i := range rawBranches { commit, err := rawBranches[i].GetCommit() if err != nil { - ctx.Handle(500, "GetCommit", err) + ctx.ServerError("GetCommit", err) return nil } isProtected, err := ctx.Repo.Repository.IsProtectedBranch(rawBranches[i].Name, ctx.User) if err != nil { - ctx.Handle(500, "IsProtectedBranch", err) + ctx.ServerError("IsProtectedBranch", err) return nil } @@ -164,7 +164,7 @@ func loadBranches(ctx *context.Context) []*Branch { if ctx.Repo.IsWriter() { deletedBranches, err := getDeletedBranches(ctx) if err != nil { - ctx.Handle(500, "getDeletedBranches", err) + ctx.ServerError("getDeletedBranches", err) return nil } branches = append(branches, deletedBranches...) @@ -196,7 +196,7 @@ func getDeletedBranches(ctx *context.Context) ([]*Branch, error) { // CreateBranch creates new branch in repository func CreateBranch(ctx *context.Context, form auth.NewBranchForm) { if !ctx.Repo.CanCreateBranch() { - ctx.Handle(404, "CreateBranch", nil) + ctx.NotFound("CreateBranch", nil) return } @@ -232,7 +232,7 @@ func CreateBranch(ctx *context.Context, form auth.NewBranchForm) { return } - ctx.Handle(500, "CreateNewBranch", err) + ctx.ServerError("CreateNewBranch", err) return } |