Skip to content

Commit

Permalink
fix: replace panics with readable errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexox committed Dec 19, 2024
1 parent ca6d492 commit 20d995d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/config/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func loadRemotes(k *koanf.Koanf, filesystem afero.Fs, repo *git.Repository, remo

parser, ok := parsers[filepath.Ext(configPath)]
if !ok {
panic("TODO: unknown extension to parse")
return fmt.Errorf("can't parse config '%[1]s', file has unsupported or no extension\nhint: rename %[1]s to %[1]s.yml", configPath)
}

if err := k.Load(kfs.Provider(newIOFS(filesystem), configPath), parser, mergeJobsOption); err != nil {
Expand Down Expand Up @@ -225,7 +225,7 @@ func extendRecursive(k *koanf.Koanf, filesystem afero.Fs, root string, extends [
extent := koanf.New(".")
parser, ok := parsers[filepath.Ext(path)]
if !ok {
panic("TODO: unknown extension for extent " + path)
return fmt.Errorf("can't parse config '%[1]s', file has unsupported or no extension\nhint: rename %[1]s to %[1]s.yml", path)
}
if err := extent.Load(kfs.Provider(newIOFS(filesystem), path), parser, mergeJobsOption); err != nil {
return err
Expand Down

0 comments on commit 20d995d

Please sign in to comment.