diff options
author | Unknwon <u@gogs.io> | 2015-12-03 00:24:37 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-12-03 00:24:37 -0500 |
commit | cc8f5add6e811cc340e676f0d969a4b1dd551d89 (patch) | |
tree | 413d718eecf77c8910ca3d610942e4ceff23678e /models/error.go | |
parent | ec2423ad7c64bbef67ccee4324f2df3efe6792aa (diff) | |
download | gitea-cc8f5add6e811cc340e676f0d969a4b1dd551d89.tar.gz gitea-cc8f5add6e811cc340e676f0d969a4b1dd551d89.zip |
fix #976
Diffstat (limited to 'models/error.go')
-rw-r--r-- | models/error.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/models/error.go b/models/error.go index d005b9af73..561252e84a 100644 --- a/models/error.go +++ b/models/error.go @@ -188,6 +188,22 @@ func (err ErrKeyNameAlreadyUsed) Error() string { return fmt.Sprintf("public key already exists [owner_id: %d, name: %s]", err.OwnerID, err.Name) } +type ErrKeyAccessDenied struct { + UserID int64 + KeyID int64 + Note string +} + +func IsErrKeyAccessDenied(err error) bool { + _, ok := err.(ErrKeyAccessDenied) + return ok +} + +func (err ErrKeyAccessDenied) Error() string { + return fmt.Sprintf("user does not have access to the key [user_id: %d, key_id: %d, note: %s]", + err.UserID, err.KeyID, err.Note) +} + type ErrDeployKeyNotExist struct { ID int64 KeyID int64 |