summaryrefslogtreecommitdiffstats
path: root/models/error.go
diff options
context:
space:
mode:
authorMichael Kuhn <suraia@ikkoku.de>2017-11-21 04:49:33 +0100
committerLunny Xiao <xiaolunwen@gmail.com>2017-11-21 11:49:33 +0800
commit420fc8efc24d7a77598307557e5b38077d0efafc (patch)
tree9e94b3b70771e2ab053fab8ace2dd19f6f882d5b /models/error.go
parent1f7aab6e1976a58fef4c0f328d7ed30a30d3b476 (diff)
downloadgitea-420fc8efc24d7a77598307557e5b38077d0efafc.tar.gz
gitea-420fc8efc24d7a77598307557e5b38077d0efafc.zip
Disable add key button if SSH is disabled (#2873)
Diffstat (limited to 'models/error.go')
-rw-r--r--models/error.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/models/error.go b/models/error.go
index aa9db7abef..9df419aee8 100644
--- a/models/error.go
+++ b/models/error.go
@@ -37,6 +37,20 @@ func (err ErrNamePatternNotAllowed) Error() string {
return fmt.Sprintf("name pattern is not allowed [pattern: %s]", err.Pattern)
}
+// ErrSSHDisabled represents an "SSH disabled" error.
+type ErrSSHDisabled struct {
+}
+
+// IsErrSSHDisabled checks if an error is a ErrSSHDisabled.
+func IsErrSSHDisabled(err error) bool {
+ _, ok := err.(ErrSSHDisabled)
+ return ok
+}
+
+func (err ErrSSHDisabled) Error() string {
+ return "SSH is disabled"
+}
+
// ____ ___
// | | \______ ___________
// | | / ___// __ \_ __ \