diff options
Diffstat (limited to 'routers/api/v1/repo/git_hook.go')
-rw-r--r-- | routers/api/v1/repo/git_hook.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/routers/api/v1/repo/git_hook.go b/routers/api/v1/repo/git_hook.go index 868acf3d85..487c74e183 100644 --- a/routers/api/v1/repo/git_hook.go +++ b/routers/api/v1/repo/git_hook.go @@ -40,7 +40,7 @@ func ListGitHooks(ctx *context.APIContext) { hooks, err := ctx.Repo.GitRepo.Hooks() if err != nil { - ctx.Error(http.StatusInternalServerError, "Hooks", err) + ctx.APIErrorInternal(err) return } @@ -84,9 +84,9 @@ func GetGitHook(ctx *context.APIContext) { hook, err := ctx.Repo.GitRepo.GetHook(hookID) if err != nil { if errors.Is(err, git.ErrNotValidHook) { - ctx.NotFound() + ctx.APIErrorNotFound() } else { - ctx.Error(http.StatusInternalServerError, "GetHook", err) + ctx.APIErrorInternal(err) } return } @@ -131,16 +131,16 @@ func EditGitHook(ctx *context.APIContext) { hook, err := ctx.Repo.GitRepo.GetHook(hookID) if err != nil { if errors.Is(err, git.ErrNotValidHook) { - ctx.NotFound() + ctx.APIErrorNotFound() } else { - ctx.Error(http.StatusInternalServerError, "GetHook", err) + ctx.APIErrorInternal(err) } return } hook.Content = form.Content if err = hook.Update(); err != nil { - ctx.Error(http.StatusInternalServerError, "hook.Update", err) + ctx.APIErrorInternal(err) return } @@ -180,16 +180,16 @@ func DeleteGitHook(ctx *context.APIContext) { hook, err := ctx.Repo.GitRepo.GetHook(hookID) if err != nil { if errors.Is(err, git.ErrNotValidHook) { - ctx.NotFound() + ctx.APIErrorNotFound() } else { - ctx.Error(http.StatusInternalServerError, "GetHook", err) + ctx.APIErrorInternal(err) } return } hook.Content = "" if err = hook.Update(); err != nil { - ctx.Error(http.StatusInternalServerError, "hook.Update", err) + ctx.APIErrorInternal(err) return } |