From 1ac3bfa603ef0a5822d7e775c085c3f02fdde359 Mon Sep 17 00:00:00 2001 From: enahum Date: Mon, 20 Jun 2016 12:14:02 -0300 Subject: [PATCH] PLT-3364 Fix panic when load config failes (#3361) --- i18n/de.json | 4 ---- i18n/en.json | 4 ---- i18n/es.json | 4 ---- i18n/fr.json | 4 ---- i18n/ja.json | 4 ---- i18n/pt-BR.json | 4 ---- mattermost.go | 5 +++-- utils/config.go | 1 - 8 files changed, 3 insertions(+), 27 deletions(-) diff --git a/i18n/de.json b/i18n/de.json index f1ecd14642..4451c810ee 100644 --- a/i18n/de.json +++ b/i18n/de.json @@ -2251,10 +2251,6 @@ "id": "mattermost.system_admins.error", "translation": "Fehler beim Laden der Systemadministratoren für Sicherheitsupdates von Mattermost." }, - { - "id": "mattermost.unable_to_load_config", - "translation": "Laden der Mattermost Konfigurationsdatei nicht möglich:" - }, { "id": "mattermost.working_dir", "translation": "Aktuelles Arbeitsverzeichnis ist %v" diff --git a/i18n/en.json b/i18n/en.json index 26ba3141c9..17e3d95999 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -2255,10 +2255,6 @@ "id": "mattermost.system_admins.error", "translation": "Failed to get system admins for security update information from Mattermost." }, - { - "id": "mattermost.unable_to_load_config", - "translation": "Unable to load mattermost configuration file:" - }, { "id": "mattermost.working_dir", "translation": "Current working directory is %v" diff --git a/i18n/es.json b/i18n/es.json index 2471198397..a1d5d58807 100644 --- a/i18n/es.json +++ b/i18n/es.json @@ -2251,10 +2251,6 @@ "id": "mattermost.system_admins.error", "translation": "Falla al obtener los administradores de sistema que reciben información referente a las actualizaciones de seguridade de Mattermost." }, - { - "id": "mattermost.unable_to_load_config", - "translation": "No se pudo cargar el archivo de configuración de Mattermost:" - }, { "id": "mattermost.working_dir", "translation": "El directorio de trabajo actual es %v" diff --git a/i18n/fr.json b/i18n/fr.json index a4f71c8bda..0fd0903f9b 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -2251,10 +2251,6 @@ "id": "mattermost.system_admins.error", "translation": "Échec du chargement de la liste des administrateurs système pour les informer d'une mise à jour de sécurité de Mattermost." }, - { - "id": "mattermost.unable_to_load_config", - "translation": "Impossible de charger le fichier de configuration mattermost :" - }, { "id": "mattermost.working_dir", "translation": "Le dossier de travail actuel est %v" diff --git a/i18n/ja.json b/i18n/ja.json index 31f54a879f..090c2cf930 100644 --- a/i18n/ja.json +++ b/i18n/ja.json @@ -2251,10 +2251,6 @@ "id": "mattermost.system_admins.error", "translation": "Mattermostからのセキュリティーアップデート情報に関してシステム管理者を取得できません" }, - { - "id": "mattermost.unable_to_load_config", - "translation": "Mattermostの設定ファイルを読み込めません:" - }, { "id": "mattermost.working_dir", "translation": "現在のワーキングディレクトリーは%vです" diff --git a/i18n/pt-BR.json b/i18n/pt-BR.json index fc96fe55fd..bcd7fdef49 100644 --- a/i18n/pt-BR.json +++ b/i18n/pt-BR.json @@ -2251,10 +2251,6 @@ "id": "mattermost.system_admins.error", "translation": "Falha ao obter administradores do sistema para a informação de atualização de segurança do Mattermost." }, - { - "id": "mattermost.unable_to_load_config", - "translation": "Não foi possível carregar o arquivo de configuração do mattermost:" - }, { "id": "mattermost.working_dir", "translation": "Diretório atual é %v" diff --git a/mattermost.go b/mattermost.go index 67428275a1..963978ecfe 100644 --- a/mattermost.go +++ b/mattermost.go @@ -71,7 +71,7 @@ var flagRunCmds bool func doLoadConfig(filename string) (err string) { defer func() { if r := recover(); r != nil { - err = r.(string) + err = fmt.Sprintf("Error loding config, err=%v", r) } }() utils.LoadConfig(filename) @@ -83,7 +83,7 @@ func main() { parseCmds() if errstr := doLoadConfig(flagConfigFile); errstr != "" { - l4g.Exit(utils.T("mattermost.unable_to_load_config"), errstr) + l4g.Exit("Unable to load mattermost configuration file:", errstr) return } @@ -91,6 +91,7 @@ func main() { utils.ConfigureCmdLineLog() } utils.InitTranslations(utils.Cfg.LocalizationSettings) + utils.TestConnection(utils.Cfg) pwd, _ := os.Getwd() l4g.Info(utils.T("mattermost.current_version"), model.CurrentVersion, model.BuildNumber, model.BuildDate, model.BuildHash, model.BuildHashEnterprise) diff --git a/utils/config.go b/utils/config.go index f3b62a25a8..5b8ba09064 100644 --- a/utils/config.go +++ b/utils/config.go @@ -178,7 +178,6 @@ func LoadConfig(fileName string) { } configureLog(&config.LogSettings) - TestConnection(&config) if config.FileSettings.DriverName == model.IMAGE_DRIVER_LOCAL { dir := config.FileSettings.Directory