handle Loader.Load return value error
This commit is contained in:
@@ -30,7 +30,7 @@ type watcher struct {
|
||||
value reader.Value
|
||||
}
|
||||
|
||||
func newConfig(opts ...Option) Config {
|
||||
func newConfig(opts ...Option) (Config, error) {
|
||||
options := Options{
|
||||
Loader: memory.NewLoader(),
|
||||
Reader: json.NewReader(),
|
||||
@@ -40,7 +40,10 @@ func newConfig(opts ...Option) Config {
|
||||
o(&options)
|
||||
}
|
||||
|
||||
options.Loader.Load(options.Source...)
|
||||
if err := options.Loader.Load(options.Source...); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
snap, _ := options.Loader.Snapshot()
|
||||
vals, _ := options.Reader.Values(snap.ChangeSet)
|
||||
|
||||
@@ -53,7 +56,7 @@ func newConfig(opts ...Option) Config {
|
||||
|
||||
go c.run()
|
||||
|
||||
return c
|
||||
return c, nil
|
||||
}
|
||||
|
||||
func (c *config) run() {
|
||||
|
||||
Reference in New Issue
Block a user