-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reporegistry: add NoReposLoadedError and use it
Add `NoReposLoadedError` custom error type for the case when any function that is supposed to load repository configs, does not load any. Use it in all functions that are directly loading repositories from configuration files. I considered `NoReposError` name, but that could be later added for functions such as `RepoRegistry.ReposBy...()`, in case there are no repositories in the RepoRegistry for the given image type / arch. Signed-off-by: Tomáš Hozza <[email protected]>
- Loading branch information
Showing
3 changed files
with
18 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package reporegistry | ||
|
||
import "fmt" | ||
|
||
// NoReposLoadedError is an error type that is returned when no repositories | ||
// are loaded from the given paths. | ||
type NoReposLoadedError struct { | ||
Paths []string | ||
} | ||
|
||
func (e *NoReposLoadedError) Error() string { | ||
return fmt.Sprintf("no repositories found in the given paths: %v", e.Paths) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters