aboutsummaryrefslogtreecommitdiff
path: root/config/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'config/config.go')
-rw-r--r--config/config.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/config/config.go b/config/config.go
index be05cb5..2ec6706 100644
--- a/config/config.go
+++ b/config/config.go
@@ -1,8 +1,8 @@
package config
import (
+ "github.com/pkg/errors"
"io/ioutil"
- "log"
"gopkg.in/yaml.v2"
)
@@ -47,18 +47,18 @@ type TelegramTdlibClientConfig struct {
UseChatInfoDatabase bool `yaml:":use_chat_info_database"`
}
-func ReadConfig(path string) Config {
+func ReadConfig(path string) (Config, error) {
var config Config
file, err := ioutil.ReadFile(path)
if err != nil {
- log.Fatalf("Can't open config file: %v", err)
+ return config, errors.Wrap(err, "Can't open config file")
}
err = yaml.Unmarshal(file, &config)
if err != nil {
- log.Fatalf("Error parsing config: %v", err)
+ return config, errors.Wrap(err, "Error parsing config")
}
- return config
+ return config, nil
}