internal/rpmmd: replace RepositoryError with plain error

The `RepositoryError` structure was weirdly used instead of a plan
`error` type and added no value. Delete it and replace its only use with
plain `error`.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2022-11-29 11:49:01 +01:00 committed by Ondřej Budai
parent 2c794c9e94
commit d0a3ad470d

View file

@ -178,14 +178,6 @@ type PackageInfo struct {
Dependencies []PackageSpec `json:"dependencies,omitempty"`
}
type RepositoryError struct {
msg string
}
func (re *RepositoryError) Error() string {
return re.msg
}
func GetVerStrFromPackageSpecList(pkgs []PackageSpec, packageName string) (string, error) {
for _, pkg := range pkgs {
if pkg.Name == packageName {
@ -310,7 +302,7 @@ func LoadRepositories(confPaths []string, distro string) (map[string][]RepoConfi
}
if repoConfigs == nil {
return nil, &RepositoryError{"LoadRepositories failed: none of the provided paths contain distro configuration"}
return nil, fmt.Errorf("LoadRepositories failed: none of the provided paths contain distro configuration")
}
return repoConfigs, nil