diff options
Diffstat (limited to 'routers/api/v1/repo/hook.go')
-rw-r--r-- | routers/api/v1/repo/hook.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/routers/api/v1/repo/hook.go b/routers/api/v1/repo/hook.go index 03143c8f99..ac47e15d64 100644 --- a/routers/api/v1/repo/hook.go +++ b/routers/api/v1/repo/hook.go @@ -61,7 +61,7 @@ func ListHooks(ctx *context.APIContext) { hooks, count, err := db.FindAndCount[webhook.Webhook](ctx, opts) if err != nil { - ctx.InternalServerError(err) + ctx.APIErrorInternal(err) return } @@ -69,7 +69,7 @@ func ListHooks(ctx *context.APIContext) { for i := range hooks { apiHooks[i], err = webhook_service.ToHook(ctx.Repo.RepoLink, hooks[i]) if err != nil { - ctx.InternalServerError(err) + ctx.APIErrorInternal(err) return } } @@ -116,7 +116,7 @@ func GetHook(ctx *context.APIContext) { } apiHook, err := webhook_service.ToHook(repo.RepoLink, hook) if err != nil { - ctx.InternalServerError(err) + ctx.APIErrorInternal(err) return } ctx.JSON(http.StatusOK, apiHook) @@ -189,7 +189,7 @@ func TestHook(ctx *context.APIContext) { Pusher: convert.ToUserWithAccessMode(ctx, ctx.Doer, perm.AccessModeNone), Sender: convert.ToUserWithAccessMode(ctx, ctx.Doer, perm.AccessModeNone), }); err != nil { - ctx.Error(http.StatusInternalServerError, "PrepareWebhook: ", err) + ctx.APIErrorInternal(err) return } @@ -298,9 +298,9 @@ func DeleteHook(ctx *context.APIContext) { // "$ref": "#/responses/notFound" if err := webhook.DeleteWebhookByRepoID(ctx, ctx.Repo.Repository.ID, ctx.PathParamInt64("id")); err != nil { if webhook.IsErrWebhookNotExist(err) { - ctx.NotFound() + ctx.APIErrorNotFound() } else { - ctx.Error(http.StatusInternalServerError, "DeleteWebhookByRepoID", err) + ctx.APIErrorInternal(err) } return } |