Files
Gogs/internal/database/errors/repo.go
ᴊᴏᴇ ᴄʜᴇɴ 59e9fa191b chore: remove all MIT license file headers (#8083)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
2026-01-08 19:32:15 -05:00

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)
}