@@ -144,6 +144,8 @@ func CreateGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption) {
144144 // responses:
145145 // "201":
146146 // "$ref": "#/responses/GPGKey"
147+ // "404":
148+ // "$ref": "#/responses/notFound"
147149 // "422":
148150 // "$ref": "#/responses/validationError"
149151
@@ -169,6 +171,8 @@ func DeleteGPGKey(ctx *context.APIContext) {
169171 // "$ref": "#/responses/empty"
170172 // "403":
171173 // "$ref": "#/responses/forbidden"
174+ // "404":
175+ // "$ref": "#/responses/notFound"
172176
173177 if err := models .DeleteGPGKey (ctx .User , ctx .ParamsInt64 (":id" )); err != nil {
174178 if models .IsErrGPGKeyAccessDenied (err ) {
@@ -186,9 +190,13 @@ func DeleteGPGKey(ctx *context.APIContext) {
186190func HandleAddGPGKeyError (ctx * context.APIContext , err error ) {
187191 switch {
188192 case models .IsErrGPGKeyAccessDenied (err ):
189- ctx .Error (http .StatusUnprocessableEntity , "" , "You do not have access to this GPG key" )
193+ ctx .Error (http .StatusUnprocessableEntity , "GPGKeyAccessDenied " , "You do not have access to this GPG key" )
190194 case models .IsErrGPGKeyIDAlreadyUsed (err ):
191- ctx .Error (http .StatusUnprocessableEntity , "" , "A key with the same id already exists" )
195+ ctx .Error (http .StatusUnprocessableEntity , "GPGKeyIDAlreadyUsed" , "A key with the same id already exists" )
196+ case models .IsErrGPGKeyParsing (err ):
197+ ctx .Error (http .StatusUnprocessableEntity , "GPGKeyParsing" , err )
198+ case models .IsErrGPGNoEmailFound (err ):
199+ ctx .Error (http .StatusNotFound , "GPGNoEmailFound" , err )
192200 default :
193201 ctx .Error (http .StatusInternalServerError , "AddGPGKey" , err )
194202 }
0 commit comments