Bug fixes for webhook API (#650)

This commit is contained in:
Ethan Koenig 2017-01-13 21:14:48 -05:00 committed by Lunny Xiao
parent 87ad4961f6
commit 27fcf8d30a
4 changed files with 54 additions and 7 deletions

View file

@ -58,7 +58,11 @@ func DeleteHook(ctx *context.APIContext) {
org := ctx.Org.Organization
hookID := ctx.ParamsInt64(":id")
if err := models.DeleteWebhookByOrgID(org.ID, hookID); err != nil {
ctx.Error(500, "DeleteWebhookByOrgID", err)
if models.IsErrWebhookNotExist(err) {
ctx.Status(404)
} else {
ctx.Error(500, "DeleteWebhookByOrgID", err)
}
return
}
ctx.Status(204)