From f455125d4de8c788143a24edefb8c6b2cef0f524 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Wed, 18 Nov 2015 21:21:47 -0500 Subject: fix #878 --- routers/api/v1/repo_hooks.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'routers/api/v1/repo_hooks.go') diff --git a/routers/api/v1/repo_hooks.go b/routers/api/v1/repo_hooks.go index 91547cf1..77c2ba66 100644 --- a/routers/api/v1/repo_hooks.go +++ b/routers/api/v1/repo_hooks.go @@ -44,9 +44,9 @@ func ToApiHook(repoLink string, w *models.Webhook) *api.Hook { // https://github.com/gogits/go-gogs-client/wiki/Repositories#list-hooks func ListRepoHooks(ctx *middleware.Context) { - hooks, err := models.GetWebhooksByRepoId(ctx.Repo.Repository.ID) + hooks, err := models.GetWebhooksByRepoID(ctx.Repo.Repository.ID) if err != nil { - ctx.APIError(500, "GetWebhooksByRepoId", err) + ctx.APIError(500, "GetWebhooksByRepoID", err) return } @@ -127,7 +127,11 @@ func CreateRepoHook(ctx *middleware.Context, form api.CreateHookOption) { func EditRepoHook(ctx *middleware.Context, form api.EditHookOption) { w, err := models.GetWebhookByID(ctx.ParamsInt64(":id")) if err != nil { - ctx.APIError(500, "GetWebhookById", err) + if models.IsErrWebhookNotExist(err) { + ctx.Error(404) + } else { + ctx.APIError(500, "GetWebhookById", err) + } return } -- cgit v1.2.3