aboutsummaryrefslogtreecommitdiff
path: root/models/errors
diff options
context:
space:
mode:
Diffstat (limited to 'models/errors')
-rw-r--r--models/errors/errors.go14
-rw-r--r--models/errors/issue.go35
-rw-r--r--models/errors/login_source.go60
-rw-r--r--models/errors/org.go21
-rw-r--r--models/errors/repo.go87
-rw-r--r--models/errors/token.go16
-rw-r--r--models/errors/two_factor.go33
-rw-r--r--models/errors/user.go45
-rw-r--r--models/errors/user_mail.go33
-rw-r--r--models/errors/webhook.go34
10 files changed, 0 insertions, 378 deletions
diff --git a/models/errors/errors.go b/models/errors/errors.go
deleted file mode 100644
index cc231436..00000000
--- a/models/errors/errors.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2017 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package errors
-
-import "errors"
-
-var InternalServerError = errors.New("internal server error")
-
-// New is a wrapper of real errors.New function.
-func New(text string) error {
- return errors.New(text)
-}
diff --git a/models/errors/issue.go b/models/errors/issue.go
deleted file mode 100644
index 903cc977..00000000
--- a/models/errors/issue.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2017 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package errors
-
-import "fmt"
-
-type IssueNotExist struct {
- ID int64
- RepoID int64
- Index int64
-}
-
-func IsIssueNotExist(err error) bool {
- _, ok := err.(IssueNotExist)
- return ok
-}
-
-func (err IssueNotExist) Error() string {
- return fmt.Sprintf("issue does not exist [id: %d, repo_id: %d, index: %d]", err.ID, err.RepoID, err.Index)
-}
-
-type InvalidIssueReference struct {
- Ref string
-}
-
-func IsInvalidIssueReference(err error) bool {
- _, ok := err.(InvalidIssueReference)
- return ok
-}
-
-func (err InvalidIssueReference) Error() string {
- return fmt.Sprintf("invalid issue reference [ref: %s]", err.Ref)
-}
diff --git a/models/errors/login_source.go b/models/errors/login_source.go
deleted file mode 100644
index dd18664e..00000000
--- a/models/errors/login_source.go
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2017 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package errors
-
-import "fmt"
-
-type LoginSourceNotExist struct {
- ID int64
-}
-
-func IsLoginSourceNotExist(err error) bool {
- _, ok := err.(LoginSourceNotExist)
- return ok
-}
-
-func (err LoginSourceNotExist) Error() string {
- return fmt.Sprintf("login source does not exist [id: %d]", err.ID)
-}
-
-type LoginSourceNotActivated struct {
- SourceID int64
-}
-
-func IsLoginSourceNotActivated(err error) bool {
- _, ok := err.(LoginSourceNotActivated)
- return ok
-}
-
-func (err LoginSourceNotActivated) Error() string {
- return fmt.Sprintf("login source is not activated [source_id: %d]", err.SourceID)
-}
-
-type InvalidLoginSourceType struct {
- Type interface{}
-}
-
-func IsInvalidLoginSourceType(err error) bool {
- _, ok := err.(InvalidLoginSourceType)
- return ok
-}
-
-func (err InvalidLoginSourceType) Error() string {
- return fmt.Sprintf("invalid login source type [type: %v]", err.Type)
-}
-
-type LoginSourceMismatch struct {
- Expect int64
- Actual int64
-}
-
-func IsLoginSourceMismatch(err error) bool {
- _, ok := err.(LoginSourceMismatch)
- return ok
-}
-
-func (err LoginSourceMismatch) Error() string {
- return fmt.Sprintf("login source mismatch [expect: %d, actual: %d]", err.Expect, err.Actual)
-}
diff --git a/models/errors/org.go b/models/errors/org.go
deleted file mode 100644
index 56532746..00000000
--- a/models/errors/org.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2018 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package errors
-
-import "fmt"
-
-type TeamNotExist struct {
- TeamID int64
- Name string
-}
-
-func IsTeamNotExist(err error) bool {
- _, ok := err.(TeamNotExist)
- return ok
-}
-
-func (err TeamNotExist) Error() string {
- return fmt.Sprintf("team does not exist [team_id: %d, name: %s]", err.TeamID, err.Name)
-}
diff --git a/models/errors/repo.go b/models/errors/repo.go
deleted file mode 100644
index c9894af9..00000000
--- a/models/errors/repo.go
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2017 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package errors
-
-import "fmt"
-
-type RepoNotExist struct {
- ID int64
- UserID int64
- Name string
-}
-
-func IsRepoNotExist(err error) bool {
- _, ok := err.(RepoNotExist)
- return ok
-}
-
-func (err RepoNotExist) Error() string {
- return fmt.Sprintf("repository does not exist [id: %d, user_id: %d, name: %s]", err.ID, err.UserID, err.Name)
-}
-
-type ReachLimitOfRepo struct {
- Limit int
-}
-
-func IsReachLimitOfRepo(err error) bool {
- _, ok := err.(ReachLimitOfRepo)
- return ok
-}
-
-func (err ReachLimitOfRepo) Error() string {
- return fmt.Sprintf("user has reached maximum limit of repositories [limit: %d]", err.Limit)
-}
-
-type InvalidRepoReference struct {
- Ref string
-}
-
-func IsInvalidRepoReference(err error) bool {
- _, ok := err.(InvalidRepoReference)
- return ok
-}
-
-func (err InvalidRepoReference) Error() string {
- return fmt.Sprintf("invalid repository reference [ref: %s]", err.Ref)
-}
-
-type MirrorNotExist struct {
- RepoID int64
-}
-
-func IsMirrorNotExist(err error) bool {
- _, ok := err.(MirrorNotExist)
- return ok
-}
-
-func (err MirrorNotExist) Error() string {
- return fmt.Sprintf("mirror does not exist [repo_id: %d]", err.RepoID)
-}
-
-type BranchAlreadyExists struct {
- Name string
-}
-
-func IsBranchAlreadyExists(err error) bool {
- _, ok := err.(BranchAlreadyExists)
- return ok
-}
-
-func (err BranchAlreadyExists) Error() string {
- return fmt.Sprintf("branch already exists [name: %s]", err.Name)
-}
-
-type ErrBranchNotExist struct {
- Name string
-}
-
-func IsErrBranchNotExist(err error) bool {
- _, ok := err.(ErrBranchNotExist)
- return ok
-}
-
-func (err ErrBranchNotExist) Error() string {
- return fmt.Sprintf("branch does not exist [name: %s]", err.Name)
-}
diff --git a/models/errors/token.go b/models/errors/token.go
deleted file mode 100644
index d6a4577a..00000000
--- a/models/errors/token.go
+++ /dev/null
@@ -1,16 +0,0 @@
-package errors
-
-import "fmt"
-
-type AccessTokenNameAlreadyExist struct {
- Name string
-}
-
-func IsAccessTokenNameAlreadyExist(err error) bool {
- _, ok := err.(AccessTokenNameAlreadyExist)
- return ok
-}
-
-func (err AccessTokenNameAlreadyExist) Error() string {
- return fmt.Sprintf("access token already exist [name: %s]", err.Name)
-}
diff --git a/models/errors/two_factor.go b/models/errors/two_factor.go
deleted file mode 100644
index 02cdcf5c..00000000
--- a/models/errors/two_factor.go
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2017 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package errors
-
-import "fmt"
-
-type TwoFactorNotFound struct {
- UserID int64
-}
-
-func IsTwoFactorNotFound(err error) bool {
- _, ok := err.(TwoFactorNotFound)
- return ok
-}
-
-func (err TwoFactorNotFound) Error() string {
- return fmt.Sprintf("two-factor authentication does not found [user_id: %d]", err.UserID)
-}
-
-type TwoFactorRecoveryCodeNotFound struct {
- Code string
-}
-
-func IsTwoFactorRecoveryCodeNotFound(err error) bool {
- _, ok := err.(TwoFactorRecoveryCodeNotFound)
- return ok
-}
-
-func (err TwoFactorRecoveryCodeNotFound) Error() string {
- return fmt.Sprintf("two-factor recovery code does not found [code: %s]", err.Code)
-}
diff --git a/models/errors/user.go b/models/errors/user.go
deleted file mode 100644
index 526d4b2d..00000000
--- a/models/errors/user.go
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2017 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package errors
-
-import "fmt"
-
-type EmptyName struct{}
-
-func IsEmptyName(err error) bool {
- _, ok := err.(EmptyName)
- return ok
-}
-
-func (err EmptyName) Error() string {
- return "empty name"
-}
-
-type UserNotExist struct {
- UserID int64
- Name string
-}
-
-func IsUserNotExist(err error) bool {
- _, ok := err.(UserNotExist)
- return ok
-}
-
-func (err UserNotExist) Error() string {
- return fmt.Sprintf("user does not exist [user_id: %d, name: %s]", err.UserID, err.Name)
-}
-
-type UserNotKeyOwner struct {
- KeyID int64
-}
-
-func IsUserNotKeyOwner(err error) bool {
- _, ok := err.(UserNotKeyOwner)
- return ok
-}
-
-func (err UserNotKeyOwner) Error() string {
- return fmt.Sprintf("user is not the owner of public key [key_id: %d]", err.KeyID)
-}
diff --git a/models/errors/user_mail.go b/models/errors/user_mail.go
deleted file mode 100644
index fcdeb78c..00000000
--- a/models/errors/user_mail.go
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2017 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package errors
-
-import "fmt"
-
-type EmailNotFound struct {
- Email string
-}
-
-func IsEmailNotFound(err error) bool {
- _, ok := err.(EmailNotFound)
- return ok
-}
-
-func (err EmailNotFound) Error() string {
- return fmt.Sprintf("email is not found [email: %s]", err.Email)
-}
-
-type EmailNotVerified struct {
- Email string
-}
-
-func IsEmailNotVerified(err error) bool {
- _, ok := err.(EmailNotVerified)
- return ok
-}
-
-func (err EmailNotVerified) Error() string {
- return fmt.Sprintf("email has not been verified [email: %s]", err.Email)
-}
diff --git a/models/errors/webhook.go b/models/errors/webhook.go
deleted file mode 100644
index 76cf8cb4..00000000
--- a/models/errors/webhook.go
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2017 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package errors
-
-import "fmt"
-
-type WebhookNotExist struct {
- ID int64
-}
-
-func IsWebhookNotExist(err error) bool {
- _, ok := err.(WebhookNotExist)
- return ok
-}
-
-func (err WebhookNotExist) Error() string {
- return fmt.Sprintf("webhook does not exist [id: %d]", err.ID)
-}
-
-type HookTaskNotExist struct {
- HookID int64
- UUID string
-}
-
-func IsHookTaskNotExist(err error) bool {
- _, ok := err.(HookTaskNotExist)
- return ok
-}
-
-func (err HookTaskNotExist) Error() string {
- return fmt.Sprintf("hook task does not exist [hook_id: %d, uuid: %s]", err.HookID, err.UUID)
-}