@@ -215,6 +215,9 @@ func CreateRelease(ctx *context.APIContext) {
215
215
// "$ref": "#/responses/notFound"
216
216
// "409":
217
217
// "$ref": "#/responses/error"
218
+ // "422":
219
+ // "$ref": "#/responses/validationError"
220
+
218
221
form := web .GetForm (ctx ).(* api.CreateReleaseOption )
219
222
if ctx .Repo .Repository .IsEmpty {
220
223
ctx .Error (http .StatusUnprocessableEntity , "RepoIsEmpty" , fmt .Errorf ("repo is empty" ))
@@ -246,6 +249,8 @@ func CreateRelease(ctx *context.APIContext) {
246
249
if err := release_service .CreateRelease (ctx .Repo .GitRepo , rel , nil , "" ); err != nil {
247
250
if repo_model .IsErrReleaseAlreadyExist (err ) {
248
251
ctx .Error (http .StatusConflict , "ReleaseAlreadyExist" , err )
252
+ } else if models .IsErrProtectedTagName (err ) {
253
+ ctx .Error (http .StatusUnprocessableEntity , "ProtectedTagName" , err )
249
254
} else {
250
255
ctx .Error (http .StatusInternalServerError , "CreateRelease" , err )
251
256
}
@@ -386,8 +391,8 @@ func DeleteRelease(ctx *context.APIContext) {
386
391
// "$ref": "#/responses/empty"
387
392
// "404":
388
393
// "$ref": "#/responses/notFound"
389
- // "405 ":
390
- // "$ref": "#/responses/empty "
394
+ // "422 ":
395
+ // "$ref": "#/responses/validationError "
391
396
392
397
id := ctx .ParamsInt64 (":id" )
393
398
rel , err := repo_model .GetReleaseForRepoByID (ctx , ctx .Repo .Repository .ID , id )
@@ -401,7 +406,7 @@ func DeleteRelease(ctx *context.APIContext) {
401
406
}
402
407
if err := release_service .DeleteReleaseByID (ctx , ctx .Repo .Repository , rel , ctx .Doer , false ); err != nil {
403
408
if models .IsErrProtectedTagName (err ) {
404
- ctx .Error (http .StatusMethodNotAllowed , "delTag" , "user not allowed to delete protected tag" )
409
+ ctx .Error (http .StatusUnprocessableEntity , "delTag" , "user not allowed to delete protected tag" )
405
410
return
406
411
}
407
412
ctx .Error (http .StatusInternalServerError , "DeleteReleaseByID" , err )
0 commit comments