diff options
Diffstat (limited to 'routers/api/v1/user/key.go')
-rw-r--r-- | routers/api/v1/user/key.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/routers/api/v1/user/key.go b/routers/api/v1/user/key.go index 3649dac9b9..c36ef763dd 100644 --- a/routers/api/v1/user/key.go +++ b/routers/api/v1/user/key.go @@ -178,8 +178,12 @@ func DeletePublicKey(ctx *context.APIContext) { // "$ref": "#/responses/empty" // "403": // "$ref": "#/responses/forbidden" + // "404": + // "$ref": "#/responses/notFound" if err := models.DeletePublicKey(ctx.User, ctx.ParamsInt64(":id")); err != nil { - if models.IsErrKeyAccessDenied(err) { + if models.IsErrKeyNotExist(err) { + ctx.Status(404) + } else if models.IsErrKeyAccessDenied(err) { ctx.Error(403, "", "You do not have access to this key") } else { ctx.Error(500, "DeletePublicKey", err) |