diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-12-10 09:27:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-10 09:27:50 +0800 |
commit | 719bddcd76610a63dadc8555760072957a11cf30 (patch) | |
tree | 0df26092fba7e3e21444fe493e6b349473b6b0cb /models/error.go | |
parent | fb8166c6c6b652a0e6fa98681780a6a71090faf3 (diff) | |
download | gitea-719bddcd76610a63dadc8555760072957a11cf30.tar.gz gitea-719bddcd76610a63dadc8555760072957a11cf30.zip |
Move repository model into models/repo (#17933)
* Some refactors related repository model
* Move more methods out of repository
* Move repository into models/repo
* Fix test
* Fix test
* some improvements
* Remove unnecessary function
Diffstat (limited to 'models/error.go')
-rw-r--r-- | models/error.go | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/models/error.go b/models/error.go index 36c70e49ad..20ed7f90e1 100644 --- a/models/error.go +++ b/models/error.go @@ -9,6 +9,7 @@ import ( "fmt" "code.gitea.io/gitea/models/perm" + repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/modules/git" ) @@ -548,32 +549,6 @@ 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) } -// __________ .__ __ -// \______ \ ____ ______ ____ _____|__|/ |_ ___________ ___.__. -// | _// __ \\____ \ / _ \/ ___/ \ __\/ _ \_ __ < | | -// | | \ ___/| |_> > <_> )___ \| || | ( <_> ) | \/\___ | -// |____|_ /\___ > __/ \____/____ >__||__| \____/|__| / ____| -// \/ \/|__| \/ \/ - -// ErrRepoNotExist represents a "RepoNotExist" kind of error. -type ErrRepoNotExist struct { - ID int64 - UID int64 - OwnerName string - Name string -} - -// IsErrRepoNotExist checks if an error is a ErrRepoNotExist. -func IsErrRepoNotExist(err error) bool { - _, ok := err.(ErrRepoNotExist) - return ok -} - -func (err ErrRepoNotExist) Error() string { - return fmt.Sprintf("repository does not exist [id: %d, uid: %d, owner_name: %s, name: %s]", - err.ID, err.UID, err.OwnerName, err.Name) -} - // ErrNoPendingRepoTransfer is an error type for repositories without a pending // transfer request type ErrNoPendingRepoTransfer struct { @@ -1283,7 +1258,7 @@ func (err ErrPullRequestHeadRepoMissing) Error() string { // ErrInvalidMergeStyle represents an error if merging with disabled merge strategy type ErrInvalidMergeStyle struct { ID int64 - Style MergeStyle + Style repo_model.MergeStyle } // IsErrInvalidMergeStyle checks if an error is a ErrInvalidMergeStyle. @@ -1299,7 +1274,7 @@ func (err ErrInvalidMergeStyle) Error() string { // ErrMergeConflicts represents an error if merging fails with a conflict type ErrMergeConflicts struct { - Style MergeStyle + Style repo_model.MergeStyle StdOut string StdErr string Err error @@ -1317,7 +1292,7 @@ func (err ErrMergeConflicts) Error() string { // ErrMergeUnrelatedHistories represents an error if merging fails due to unrelated histories type ErrMergeUnrelatedHistories struct { - Style MergeStyle + Style repo_model.MergeStyle StdOut string StdErr string Err error @@ -1335,7 +1310,7 @@ func (err ErrMergeUnrelatedHistories) Error() string { // ErrRebaseConflicts represents an error if rebase fails with a conflict type ErrRebaseConflicts struct { - Style MergeStyle + Style repo_model.MergeStyle CommitSHA string StdOut string StdErr string |