From 378e3f3018591b92aea9fa4801583cc0df97b98e Mon Sep 17 00:00:00 2001 From: Kim Lindhardt Madsen Date: Sat, 12 Sep 2015 12:49:06 +0200 Subject: [PATCH] tested create release --- routers/api/v1/repo_releases.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/routers/api/v1/repo_releases.go b/routers/api/v1/repo_releases.go index 863abd7b0..4f9765e8c 100644 --- a/routers/api/v1/repo_releases.go +++ b/routers/api/v1/repo_releases.go @@ -73,7 +73,7 @@ func ReleaseByName(ctx *middleware.Context) { func CreateRelease(ctx *middleware.Context, form api.CreateReleaseOption) { if !ctx.Repo.GitRepo.IsBranchExist(form.Target) { - ctx.Handle(500, "IsBranchExist", errors.New("Branch did not exist, " + form.Target)) + ctx.Handle(400, "IsBranchExist", errors.New("Branch did not exist, " + form.Target)) return } @@ -102,7 +102,11 @@ func CreateRelease(ctx *middleware.Context, form api.CreateReleaseOption) { IsPrerelease: form.IsPrerelease, } - models.CreateRelease(ctx.Repo.GitRepo, rel) + err = models.CreateRelease(ctx.Repo.GitRepo, rel) + if err != nil { + ctx.Handle(400, "CreateRelease", err) + return + } ctx.JSON(201, ToApiRelease(rel, ctx.User))