提交 8786602d 作者: Juan Batiz-Benet

config: nicer error to user

上级 1a5cb300
...@@ -17,7 +17,10 @@ func ReadConfigFile(filename string, cfg interface{}) error { ...@@ -17,7 +17,10 @@ func ReadConfigFile(filename string, cfg interface{}) error {
} }
defer f.Close() defer f.Close()
return Decode(f, cfg) if err := Decode(f, cfg); err != nil {
return fmt.Errorf("Failure to decode config: %s", err)
}
return nil
} }
// WriteConfigFile writes the config from `cfg` into `filename`. // WriteConfigFile writes the config from `cfg` into `filename`.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论