diff options
author | John Olheiser <42128690+jolheiser@users.noreply.github.com> | 2019-06-12 15:20:43 -0500 |
---|---|---|
committer | techknowlogick <hello@techknowlogick.com> | 2019-06-12 16:20:43 -0400 |
commit | 744fd6a1c87f2ad39dbe282133fae1190df6e538 (patch) | |
tree | 3838fb17bab5a39c82df33a8a5435701dd79add1 /models/error.go | |
parent | f9ec2f89f2265bc1371a6c62359de9816534fa6b (diff) | |
download | gitea-744fd6a1c87f2ad39dbe282133fae1190df6e538.tar.gz gitea-744fd6a1c87f2ad39dbe282133fae1190df6e538.zip |
Add error for fork already existing (#7185)
Diffstat (limited to 'models/error.go')
-rw-r--r-- | models/error.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/models/error.go b/models/error.go index fe0f05d36b..11ca6e6863 100644 --- a/models/error.go +++ b/models/error.go @@ -674,6 +674,23 @@ func (err ErrRepoAlreadyExist) Error() string { return fmt.Sprintf("repository already exists [uname: %s, name: %s]", err.Uname, err.Name) } +// ErrForkAlreadyExist represents a "ForkAlreadyExist" kind of error. +type ErrForkAlreadyExist struct { + Uname string + RepoName string + ForkName string +} + +// IsErrForkAlreadyExist checks if an error is an ErrForkAlreadyExist. +func IsErrForkAlreadyExist(err error) bool { + _, ok := err.(ErrForkAlreadyExist) + return ok +} + +func (err ErrForkAlreadyExist) Error() string { + return fmt.Sprintf("repository is already forked by user [uname: %s, repo path: %s, fork path: %s]", err.Uname, err.RepoName, err.ForkName) +} + // ErrRepoRedirectNotExist represents a "RepoRedirectNotExist" kind of error. type ErrRepoRedirectNotExist struct { OwnerID int64 |