mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-06 12:28:03 +02:00
Improve error feedback for duplicate deploy keys (#13112)
Instead of a generic HTTP 500 error page, a flash message is rendered with the deploy key page template to inform the user that a key with the intended title already exists. Fixes #13110
This commit is contained in:
1 parent
0e4f663126
commit
c752ccee64
3 files changed
+6
-1
No files matched your search
@@ -177,6 +177,8 @@ func HandleAddKeyError(ctx *context.APIContext, err error) {
|
||||
ctx.Error(http.StatusUnprocessableEntity, "", "Key content has been used as non-deploy key")
|
||||
case models.IsErrKeyNameAlreadyUsed(err):
|
||||
ctx.Error(http.StatusUnprocessableEntity, "", "Key title has been used")
|
||||
case models.IsErrDeployKeyNameAlreadyUsed(err):
|
||||
ctx.Error(http.StatusUnprocessableEntity, "", "A key with the same name already exists")
|
||||
default:
|
||||
ctx.Error(http.StatusInternalServerError, "AddKey", err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user