]> source.dussan.org Git - gitea.git/commitdiff
make sure to catch the right error so it is displayed as an error on the ui not a...
authorLanre Adelowo <adelowomailbox@gmail.com>
Sun, 16 Sep 2018 15:27:43 +0000 (16:27 +0100)
committerLauris BH <lauris@nix.lv>
Sun, 16 Sep 2018 15:27:43 +0000 (18:27 +0300)
models/ssh_key.go
routers/repo/setting.go

index 9c839755c8b6ebae11f9cbb5bae93419a8727924..c2836e6885dd26a00d723c053eee935f3ebb1cfe 100644 (file)
@@ -732,7 +732,7 @@ func AddDeployKey(repoID int64, name, content string, readOnly bool) (*DeployKey
 
        key, err := addDeployKey(sess, pkey.ID, repoID, name, pkey.Fingerprint, accessMode)
        if err != nil {
-               return nil, fmt.Errorf("addDeployKey: %v", err)
+               return nil, err
        }
 
        return key, sess.Commit()
index dc558ff209ec9809a0047e3e135dd438ad384a1f..ff6b07f8e0e72c0fcda8facf50c9f51b19184749 100644 (file)
@@ -586,7 +586,7 @@ func DeployKeysPost(ctx *context.Context, form auth.AddKeyForm) {
        if err != nil {
                ctx.Data["HasError"] = true
                switch {
-               case models.IsErrKeyAlreadyExist(err):
+               case models.IsErrDeployKeyAlreadyExist(err):
                        ctx.Data["Err_Content"] = true
                        ctx.RenderWithErr(ctx.Tr("repo.settings.key_been_used"), tplDeployKeys, &form)
                case models.IsErrKeyNameAlreadyUsed(err):