aboutsummaryrefslogtreecommitdiffstats
path: root/models/error.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2022-06-12 23:51:54 +0800
committerGitHub <noreply@github.com>2022-06-12 23:51:54 +0800
commit110fc57cbcf293c19ed7017d8ea528b4bbbd7396 (patch)
treeb36eb2ee0e3f8417a35ad095e25880b778ded0ba /models/error.go
parenta9dc9b06e4a4106ec8315fe7b2922efa440ca199 (diff)
downloadgitea-110fc57cbcf293c19ed7017d8ea528b4bbbd7396.tar.gz
gitea-110fc57cbcf293c19ed7017d8ea528b4bbbd7396.zip
Move some code into models/git (#19879)
* Move access and repo permission to models/perm/access * fix test * Move some git related files into sub package models/git * Fix build * fix git test * move lfs to sub package * move more git related functions to models/git * Move functions sequence * Some improvements per @KN4CK3R and @delvh
Diffstat (limited to 'models/error.go')
-rw-r--r--models/error.go78
1 files changed, 0 insertions, 78 deletions
diff --git a/models/error.go b/models/error.go
index 0dc14c3e31..16ae52fc43 100644
--- a/models/error.go
+++ b/models/error.go
@@ -8,7 +8,6 @@ package models
import (
"fmt"
- "code.gitea.io/gitea/models/perm"
repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/modules/git"
)
@@ -145,83 +144,6 @@ func (err ErrAccessTokenEmpty) Error() string {
return "access token is empty"
}
-//.____ ____________________
-//| | \_ _____/ _____/
-//| | | __) \_____ \
-//| |___| \ / \
-//|_______ \___ / /_______ /
-// \/ \/ \/
-
-// ErrLFSLockNotExist represents a "LFSLockNotExist" kind of error.
-type ErrLFSLockNotExist struct {
- ID int64
- RepoID int64
- Path string
-}
-
-// IsErrLFSLockNotExist checks if an error is a ErrLFSLockNotExist.
-func IsErrLFSLockNotExist(err error) bool {
- _, ok := err.(ErrLFSLockNotExist)
- return ok
-}
-
-func (err ErrLFSLockNotExist) Error() string {
- return fmt.Sprintf("lfs lock does not exist [id: %d, rid: %d, path: %s]", err.ID, err.RepoID, err.Path)
-}
-
-// ErrLFSUnauthorizedAction represents a "LFSUnauthorizedAction" kind of error.
-type ErrLFSUnauthorizedAction struct {
- RepoID int64
- UserName string
- Mode perm.AccessMode
-}
-
-// IsErrLFSUnauthorizedAction checks if an error is a ErrLFSUnauthorizedAction.
-func IsErrLFSUnauthorizedAction(err error) bool {
- _, ok := err.(ErrLFSUnauthorizedAction)
- return ok
-}
-
-func (err ErrLFSUnauthorizedAction) Error() string {
- if err.Mode == perm.AccessModeWrite {
- return fmt.Sprintf("User %s doesn't have write access for lfs lock [rid: %d]", err.UserName, err.RepoID)
- }
- return fmt.Sprintf("User %s doesn't have read access for lfs lock [rid: %d]", err.UserName, err.RepoID)
-}
-
-// ErrLFSLockAlreadyExist represents a "LFSLockAlreadyExist" kind of error.
-type ErrLFSLockAlreadyExist struct {
- RepoID int64
- Path string
-}
-
-// IsErrLFSLockAlreadyExist checks if an error is a ErrLFSLockAlreadyExist.
-func IsErrLFSLockAlreadyExist(err error) bool {
- _, ok := err.(ErrLFSLockAlreadyExist)
- return ok
-}
-
-func (err ErrLFSLockAlreadyExist) Error() string {
- return fmt.Sprintf("lfs lock already exists [rid: %d, path: %s]", err.RepoID, err.Path)
-}
-
-// ErrLFSFileLocked represents a "LFSFileLocked" kind of error.
-type ErrLFSFileLocked struct {
- RepoID int64
- Path string
- UserName string
-}
-
-// IsErrLFSFileLocked checks if an error is a ErrLFSFileLocked.
-func IsErrLFSFileLocked(err error) bool {
- _, ok := err.(ErrLFSFileLocked)
- return ok
-}
-
-func (err ErrLFSFileLocked) Error() string {
- return fmt.Sprintf("File is lfs locked [repo: %d, locked by: %s, path: %s]", err.RepoID, err.UserName, err.Path)
-}
-
// ErrNoPendingRepoTransfer is an error type for repositories without a pending
// transfer request
type ErrNoPendingRepoTransfer struct {