github.com/tooploox/oya@v0.0.21-0.20230524103240-1cda1861aad6/pkg/repo/errors.go (about) 1 package repo 2 3 import ( 4 "fmt" 5 6 "github.com/tooploox/oya/pkg/semver" 7 "github.com/tooploox/oya/pkg/types" 8 ) 9 10 // ErrNotGithub indicates that the import path doesn't start with github.com. 11 type ErrNotGithub struct { 12 ImportPath types.ImportPath 13 } 14 15 func (err ErrNotGithub) Error() string { 16 return fmt.Sprintf("incorrect Github.com import path %q; expected to start with \"github.com/<user>/<repository>\"", err.ImportPath) 17 } 18 19 // ErrNoTaggedVersions indicates there are no available remote versions of the pack. 20 type ErrNoTaggedVersions struct { 21 ImportPath types.ImportPath 22 } 23 24 func (err ErrNoTaggedVersions) Error() string { 25 return fmt.Sprintf("no available remote versions for import path %q", err.ImportPath) 26 } 27 28 // ErrClone indacates problem during repository clone (doesn't exist or private) 29 type ErrClone struct { 30 RepoUrl string 31 } 32 33 func (err ErrClone) Error() string { 34 return fmt.Sprintf("failed to clone repository %v", err.RepoUrl) 35 } 36 37 // ErrCheckout indicates problem during repository checkout for ex. unknown version 38 type ErrCheckout struct { 39 ImportPath types.ImportPath 40 ImportVersion semver.Version 41 } 42 43 func (err ErrCheckout) Error() string { 44 return fmt.Sprintf("failed to get pack %v@%v", err.ImportPath, err.ImportVersion) 45 } 46 47 // ErrNoRootOyafile indicates that pack's root Oyafile is missing. 48 type ErrNoRootOyafile struct { 49 ImportPath types.ImportPath 50 Version semver.Version 51 } 52 53 func (err ErrNoRootOyafile) Error() string { 54 return fmt.Sprintf("missing top-level Oyafile for pack %v version %v", err.ImportPath, err.Version) 55 }