From 24f9ebe82bd730c5bc9cabdc7cb3ac16bf91c430 Mon Sep 17 00:00:00 2001 From: MagaSerdarov Date: Thu, 13 Apr 2023 18:13:19 +0300 Subject: [PATCH] fix #1505 viper.SetConfigFile() --- viper.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/viper.go b/viper.go index 7eac4b786..b414b6c7f 100644 --- a/viper.go +++ b/viper.go @@ -1563,7 +1563,7 @@ func (v *Viper) ReadInConfig() error { v.logger.Debug("reading file", "file", filename) file, err := afero.ReadFile(v.fs, filename) if err != nil { - return err + return ConfigFileNotFoundError{v.configName, fmt.Sprintf("%s", v.configPaths)} } config := make(map[string]interface{}) @@ -1593,7 +1593,7 @@ func (v *Viper) MergeInConfig() error { file, err := afero.ReadFile(v.fs, filename) if err != nil { - return err + return ConfigFileNotFoundError{v.configName, fmt.Sprintf("%s", v.configPaths)} } return v.MergeConfig(bytes.NewReader(file))