mirror of
https://github.com/spf13/viper.git
synced 2026-09-20 03:18:21 +00:00
docs: add explanation on read in config errors
This commit is contained in:
committed by
Márk Sági-Kazár
parent
b9dfcc5b9e
commit
5ae04a8bbf
@@ -1492,9 +1492,11 @@ func (v *Viper) ReadInConfig() error {
|
||||
v.logger.Debug("reading file", "file", filename)
|
||||
exists, err := afero.Exists(v.fs, filename)
|
||||
if err != nil {
|
||||
// We hit some other error from the filesystem that isn't a missing file
|
||||
return err
|
||||
}
|
||||
if !exists {
|
||||
// The specified config file is missing
|
||||
return FileNotFoundError{path: filename}
|
||||
}
|
||||
file, err := afero.ReadFile(v.fs, filename)
|
||||
|
||||
Reference in New Issue
Block a user