summaryrefslogtreecommitdiffstats
path: root/models/error.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-12-03 00:24:37 -0500
committerUnknwon <u@gogs.io>2015-12-03 00:24:37 -0500
commitcc8f5add6e811cc340e676f0d969a4b1dd551d89 (patch)
tree413d718eecf77c8910ca3d610942e4ceff23678e /models/error.go
parentec2423ad7c64bbef67ccee4324f2df3efe6792aa (diff)
downloadgitea-cc8f5add6e811cc340e676f0d969a4b1dd551d89.tar.gz
gitea-cc8f5add6e811cc340e676f0d969a4b1dd551d89.zip
fix #976
Diffstat (limited to 'models/error.go')
-rw-r--r--models/error.go16
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