mirror of
https://github.com/gogs/gogs.git
synced 2026-01-13 10:52:21 +01:00
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
45 lines
814 B
Go
45 lines
814 B
Go
package errors
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
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)
|
|
}
|