aboutsummaryrefslogtreecommitdiff
path: root/routes/api/v1/admin/org_repo.go
diff options
context:
space:
mode:
authorunknwon <u@gogs.io>2019-08-10 13:40:48 -0700
committerunknwon <u@gogs.io>2019-08-10 13:40:48 -0700
commitf1e0ebfe937213be2af4a3180fae9f43949de00e (patch)
tree3b462bd02b3c5d28099ca5e47e21370d8c02688a /routes/api/v1/admin/org_repo.go
parentc7ba519af2f2d8e79077d2776cb34f8b61556471 (diff)
routes/api/v1: codemod
Diffstat (limited to 'routes/api/v1/admin/org_repo.go')
-rw-r--r--routes/api/v1/admin/org_repo.go14
1 files changed, 5 insertions, 9 deletions
diff --git a/routes/api/v1/admin/org_repo.go b/routes/api/v1/admin/org_repo.go
index a2064921..b99a144f 100644
--- a/routes/api/v1/admin/org_repo.go
+++ b/routes/api/v1/admin/org_repo.go
@@ -13,11 +13,7 @@ import (
func GetRepositoryByParams(c *context.APIContext) *models.Repository {
repo, err := models.GetRepositoryByName(c.Org.Team.OrgID, c.Params(":reponame"))
if err != nil {
- if errors.IsRepoNotExist(err) {
- c.Status(404)
- } else {
- c.Error(500, "GetRepositoryByName", err)
- }
+ c.NotFoundOrServerError("GetRepositoryByName", errors.IsRepoNotExist, err)
return nil
}
return repo
@@ -29,11 +25,11 @@ func AddTeamRepository(c *context.APIContext) {
return
}
if err := c.Org.Team.AddRepository(repo); err != nil {
- c.Error(500, "AddRepository", err)
+ c.ServerError("AddRepository", err)
return
}
- c.Status(204)
+ c.NoContent()
}
func RemoveTeamRepository(c *context.APIContext) {
@@ -42,9 +38,9 @@ func RemoveTeamRepository(c *context.APIContext) {
return
}
if err := c.Org.Team.RemoveRepository(repo.ID); err != nil {
- c.Error(500, "RemoveRepository", err)
+ c.ServerError("RemoveRepository", err)
return
}
- c.Status(204)
+ c.NoContent()
}