Handle refactor (#3339)

* Replace all ctx.Handle with ctx.ServerError or ctx.NotFound

* Change Handle(403) to NotFound, avoid using macaron's NotFound
This commit is contained in:
Morgan Bazalgette 2018-01-10 22:34:17 +01:00 committed by Lauris BH
parent 45c264f681
commit 65861900cd
48 changed files with 622 additions and 610 deletions

View file

@ -117,7 +117,7 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
AllPublic: true,
})
if err != nil {
ctx.Handle(500, "SearchRepositoryByName", err)
ctx.ServerError("SearchRepositoryByName", err)
return
}
ctx.Data["Keyword"] = keyword
@ -185,7 +185,7 @@ func RenderUserSearch(ctx *context.Context, opts *models.SearchUserOptions, tplN
if len(opts.Keyword) == 0 || isKeywordValid(opts.Keyword) {
users, count, err = models.SearchUsers(opts)
if err != nil {
ctx.Handle(500, "SearchUsers", err)
ctx.ServerError("SearchUsers", err)
return
}
}
@ -226,5 +226,5 @@ func ExploreOrganizations(ctx *context.Context) {
// NotFound render 404 page
func NotFound(ctx *context.Context) {
ctx.Data["Title"] = "Page Not Found"
ctx.Handle(404, "home.NotFound", nil)
ctx.NotFound("home.NotFound", nil)
}