PLT-6471 Properly panic when translations can't be loaded (#6414)

* PLT-6471 Properly panic when translations can't be loaded

* Print usage messages when errors occur during CLI initialization

* Reverted behaviour of FindDir and added second return value to it

* Fixed merge conflict
Этот коммит содержится в:
Harrison Healey
2017-05-23 11:06:25 -04:00
коммит произвёл GitHub
родитель 69f3f2fdce
Коммит 5c1049054e
23 изменённых файлов: 189 добавлений и 73 удалений

Просмотреть файл

@@ -12,14 +12,18 @@ func initDBCommandContextCobra(cmd *cobra.Command) error {
if err != nil {
return err
}
initDBCommandContext(config)
if err := initDBCommandContext(config); err != nil {
// Returning an error just prints the usage message, so actually panic
panic(err)
}
return nil
}
func initDBCommandContext(configFileLocation string) {
if errstr := utils.InitAndLoadConfig(configFileLocation); errstr != "" {
return
func initDBCommandContext(configFileLocation string) error {
if err := utils.InitAndLoadConfig(configFileLocation); err != nil {
return err
}
utils.ConfigureCmdLineLog()
@@ -29,4 +33,6 @@ func initDBCommandContext(configFileLocation string) {
if model.BuildEnterpriseReady == "true" {
app.LoadLicense()
}
return nil
}