diff options
Diffstat (limited to 'routers/api/v1/repo/hook.go')
-rw-r--r-- | routers/api/v1/repo/hook.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/routers/api/v1/repo/hook.go b/routers/api/v1/repo/hook.go index 51f64e3452..2e3b655a12 100644 --- a/routers/api/v1/repo/hook.go +++ b/routers/api/v1/repo/hook.go @@ -59,9 +59,12 @@ func EditHook(ctx *context.APIContext, form api.EditHookOption) { // DeleteHook delete a hook of a repository func DeleteHook(ctx *context.APIContext) { if err := models.DeleteWebhookByRepoID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id")); err != nil { - ctx.Error(500, "DeleteWebhookByRepoID", err) + if models.IsErrWebhookNotExist(err) { + ctx.Status(404) + } else { + ctx.Error(500, "DeleteWebhookByRepoID", err) + } return } - ctx.Status(204) } |