rich the ConfigFileNotFoundError to resolve the issue #390

This commit is contained in:
saltbo 2020-08-07 12:06:20 +08:00
parent 3826be3135
commit cd1f0d1b5f

View file

@ -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.