docs: add explanation on read in config errors

This commit is contained in:
Matthew Coleman
2025-10-08 12:00:40 +02:00
committed by Márk Sági-Kazár
parent b9dfcc5b9e
commit 5ae04a8bbf
+2
View File
@@ -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)