aboutsummaryrefslogtreecommitdiff
path: root/internal/db/errors
diff options
context:
space:
mode:
Diffstat (limited to 'internal/db/errors')
-rw-r--r--internal/db/errors/issue.go15
-rw-r--r--internal/db/errors/org.go21
-rw-r--r--internal/db/errors/repo.go45
-rw-r--r--internal/db/errors/user.go18
-rw-r--r--internal/db/errors/webhook.go34
5 files changed, 6 insertions, 127 deletions
diff --git a/internal/db/errors/issue.go b/internal/db/errors/issue.go
index 903cc977..4ea898fb 100644
--- a/internal/db/errors/issue.go
+++ b/internal/db/errors/issue.go
@@ -6,21 +6,6 @@ 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
}
diff --git a/internal/db/errors/org.go b/internal/db/errors/org.go
deleted file mode 100644
index 56532746..00000000
--- a/internal/db/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/internal/db/errors/repo.go b/internal/db/errors/repo.go
index c9894af9..ba6c502c 100644
--- a/internal/db/errors/repo.go
+++ b/internal/db/errors/repo.go
@@ -4,35 +4,9 @@
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)
-}
+import (
+ "fmt"
+)
type InvalidRepoReference struct {
Ref string
@@ -72,16 +46,3 @@ func IsBranchAlreadyExists(err error) bool {
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/internal/db/errors/user.go b/internal/db/errors/user.go
index 526d4b2d..54a6ad50 100644
--- a/internal/db/errors/user.go
+++ b/internal/db/errors/user.go
@@ -4,7 +4,9 @@
package errors
-import "fmt"
+import (
+ "fmt"
+)
type EmptyName struct{}
@@ -17,20 +19,6 @@ 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
}
diff --git a/internal/db/errors/webhook.go b/internal/db/errors/webhook.go
deleted file mode 100644
index 76cf8cb4..00000000
--- a/internal/db/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)
-}