mirror of
https://github.com/spf13/viper
synced 2025-05-11 06:37:27 +00:00
rich the ConfigFileNotFoundError to resolve the issue #390
This commit is contained in:
parent
3826be3135
commit
cd1f0d1b5f
1 changed files with 6 additions and 1 deletions
7
viper.go
7
viper.go
|
@ -113,7 +113,12 @@ type ConfigFileNotFoundError struct {
|
|||
|
||||
// Error returns the formatted configuration error.
|
||||
func (fnfe ConfigFileNotFoundError) Error() string {
|
||||
return fmt.Sprintf("Config File %q Not Found in %q", fnfe.name, fnfe.locations)
|
||||
configFiles := make([]string, 0, len(SupportedExts))
|
||||
for _, ext := range SupportedExts {
|
||||
configFiles = append(configFiles, fmt.Sprintf("%s.%s", fnfe.name, ext))
|
||||
}
|
||||
|
||||
return fmt.Sprintf("Config Not Found in %q, ConfigFiles:\n %q", fnfe.locations, configFiles)
|
||||
}
|
||||
|
||||
// ConfigFileAlreadyExistsError denotes failure to write new configuration file.
|
||||
|
|
Loading…
Add table
Reference in a new issue