summaryrefslogtreecommitdiffstats
path: root/routers/user/profile.go
diff options
context:
space:
mode:
authorMorgan Bazalgette <git@howl.moe>2018-01-10 22:34:17 +0100
committerLauris BH <lauris@nix.lv>2018-01-10 23:34:17 +0200
commit65861900cda3bb6d9e2aa80b808b0000383c04b3 (patch)
tree8569d93b6ef092b30b35a4d4da906c6b6950e2ee /routers/user/profile.go
parent45c264f681e3f7e1a22a191029836a690959aac3 (diff)
downloadgitea-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/user/profile.go')
-rw-r--r--routers/user/profile.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/routers/user/profile.go b/routers/user/profile.go
index 86819de251..d63f84afd3 100644
--- a/routers/user/profile.go
+++ b/routers/user/profile.go
@@ -29,9 +29,9 @@ func GetUserByName(ctx *context.Context, name string) *models.User {
user, err := models.GetUserByName(name)
if err != nil {
if models.IsErrUserNotExist(err) {
- ctx.Handle(404, "GetUserByName", nil)
+ ctx.NotFound("GetUserByName", nil)
} else {
- ctx.Handle(500, "GetUserByName", err)
+ ctx.ServerError("GetUserByName", err)
}
return nil
}
@@ -79,7 +79,7 @@ func Profile(ctx *context.Context) {
// Show OpenID URIs
openIDs, err := models.GetUserOpenIDs(ctxUser.ID)
if err != nil {
- ctx.Handle(500, "GetUserOpenIDs", err)
+ ctx.ServerError("GetUserOpenIDs", err)
return
}
@@ -91,7 +91,7 @@ func Profile(ctx *context.Context) {
orgs, err := models.GetOrgsByUserID(ctxUser.ID, showPrivate)
if err != nil {
- ctx.Handle(500, "GetOrgsByUserIDDesc", err)
+ ctx.ServerError("GetOrgsByUserIDDesc", err)
return
}
@@ -147,13 +147,13 @@ func Profile(ctx *context.Context) {
if len(keyword) == 0 {
repos, err = ctxUser.GetStarredRepos(showPrivate, page, setting.UI.User.RepoPagingNum, orderBy.String())
if err != nil {
- ctx.Handle(500, "GetStarredRepos", err)
+ ctx.ServerError("GetStarredRepos", err)
return
}
count, err = ctxUser.GetStarredRepoCount(showPrivate)
if err != nil {
- ctx.Handle(500, "GetStarredRepoCount", err)
+ ctx.ServerError("GetStarredRepoCount", err)
return
}
} else {
@@ -168,7 +168,7 @@ func Profile(ctx *context.Context) {
Collaborate: util.OptionalBoolFalse,
})
if err != nil {
- ctx.Handle(500, "SearchRepositoryByName", err)
+ ctx.ServerError("SearchRepositoryByName", err)
return
}
}
@@ -181,7 +181,7 @@ func Profile(ctx *context.Context) {
var total int
repos, err = models.GetUserRepositories(ctxUser.ID, showPrivate, page, setting.UI.User.RepoPagingNum, orderBy.String())
if err != nil {
- ctx.Handle(500, "GetRepositories", err)
+ ctx.ServerError("GetRepositories", err)
return
}
ctx.Data["Repos"] = repos
@@ -191,7 +191,7 @@ func Profile(ctx *context.Context) {
} else {
count, err := models.GetPublicRepositoryCount(ctxUser)
if err != nil {
- ctx.Handle(500, "GetPublicRepositoryCount", err)
+ ctx.ServerError("GetPublicRepositoryCount", err)
return
}
total = int(count)
@@ -210,7 +210,7 @@ func Profile(ctx *context.Context) {
PageSize: setting.UI.User.RepoPagingNum,
})
if err != nil {
- ctx.Handle(500, "SearchRepositoryByName", err)
+ ctx.ServerError("SearchRepositoryByName", err)
return
}
@@ -267,7 +267,7 @@ func Action(ctx *context.Context) {
}
if err != nil {
- ctx.Handle(500, fmt.Sprintf("Action (%s)", ctx.Params(":action")), err)
+ ctx.ServerError(fmt.Sprintf("Action (%s)", ctx.Params(":action")), err)
return
}