summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/hook.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/repo/hook.go')
-rw-r--r--routers/api/v1/repo/hook.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/routers/api/v1/repo/hook.go b/routers/api/v1/repo/hook.go
index 5956fe9da9..57fff7d326 100644
--- a/routers/api/v1/repo/hook.go
+++ b/routers/api/v1/repo/hook.go
@@ -69,7 +69,11 @@ func ListHooks(ctx *context.APIContext) {
apiHooks := make([]*api.Hook, len(hooks))
for i := range hooks {
- apiHooks[i] = convert.ToHook(ctx.Repo.RepoLink, hooks[i])
+ apiHooks[i], err = convert.ToHook(ctx.Repo.RepoLink, hooks[i])
+ if err != nil {
+ ctx.InternalServerError(err)
+ return
+ }
}
ctx.SetTotalCountHeader(count)
@@ -112,7 +116,12 @@ func GetHook(ctx *context.APIContext) {
if err != nil {
return
}
- ctx.JSON(http.StatusOK, convert.ToHook(repo.RepoLink, hook))
+ apiHook, err := convert.ToHook(repo.RepoLink, hook)
+ if err != nil {
+ ctx.InternalServerError(err)
+ return
+ }
+ ctx.JSON(http.StatusOK, apiHook)
}
// TestHook tests a hook