aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/hook.go
diff options
context:
space:
mode:
authorEthan Koenig <etk39@cornell.edu>2017-01-13 21:14:48 -0500
committerLunny Xiao <xiaolunwen@gmail.com>2017-01-14 10:14:48 +0800
commit27fcf8d30a8c8dda281739c84af4033c93d96faf (patch)
tree83c4c03b76539fc1907977e6ef8f32a08846a78d /routers/api/v1/repo/hook.go
parent87ad4961f62c24cf75377f3055e9769e269c80d9 (diff)
downloadgitea-27fcf8d30a8c8dda281739c84af4033c93d96faf.tar.gz
gitea-27fcf8d30a8c8dda281739c84af4033c93d96faf.zip
Bug fixes for webhook API (#650)
Diffstat (limited to 'routers/api/v1/repo/hook.go')
-rw-r--r--routers/api/v1/repo/hook.go7
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)
}