Added title for error log when using via the api

This commit is contained in:
kolaente 2018-06-06 14:44:39 +02:00
parent 87f41c0dc0
commit c52e970dbc
No known key found for this signature in database
GPG Key ID: F40E70337AB24C9B
2 changed files with 3 additions and 3 deletions

View File

@ -202,7 +202,7 @@ func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) {
if form.Closed {
if err := issue.ChangeStatus(ctx.User, ctx.Repo.Repository, true); err != nil {
if models.IsErrDependenciesLeft(err) {
ctx.Error(http.StatusPreconditionFailed, "", "cannot close this issue because it still has open dependencies")
ctx.Error(http.StatusPreconditionFailed, "DependenciesLeft", "cannot close this issue because it still has open dependencies")
return
}
ctx.Error(500, "ChangeStatus", err)
@ -323,7 +323,7 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) {
if form.State != nil {
if err = issue.ChangeStatus(ctx.User, ctx.Repo.Repository, api.StateClosed == api.StateType(*form.State)); err != nil {
if models.IsErrDependenciesLeft(err) {
ctx.Error(http.StatusPreconditionFailed, "", "cannot close this issue because it still has open dependencies")
ctx.Error(http.StatusPreconditionFailed, "DependenciesLeft", "cannot close this issue because it still has open dependencies")
return
}
ctx.Error(500, "ChangeStatus", err)

View File

@ -380,7 +380,7 @@ func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) {
if form.State != nil {
if err = issue.ChangeStatus(ctx.User, ctx.Repo.Repository, api.StateClosed == api.StateType(*form.State)); err != nil {
if models.IsErrDependenciesLeft(err) {
ctx.Error(http.StatusPreconditionFailed, "", "cannot close this pull request because it still has open dependencies")
ctx.Error(http.StatusPreconditionFailed, "DependenciesLeft", "cannot close this pull request because it still has open dependencies")
return
}
ctx.Error(500, "ChangeStatus", err)