summaryrefslogtreecommitdiffstats
path: root/utils/config.go
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2017-08-25 11:04:37 +0100
committerSaturnino Abril <saturnino.abril@gmail.com>2017-08-25 18:04:37 +0800
commit1a2a02440c4e66d7f4869f3d24b4731c8df81fcf (patch)
tree452887dac94125b7b1152ced0f85ded11d9b092e /utils/config.go
parentf6e0310b502f5075659eb5a830d88e2026ee5f50 (diff)
downloadchat-1a2a02440c4e66d7f4869f3d24b4731c8df81fcf.tar.gz
chat-1a2a02440c4e66d7f4869f3d24b4731c8df81fcf.tar.bz2
chat-1a2a02440c4e66d7f4869f3d24b4731c8df81fcf.zip
Other Packages: NewLocAppError -> NewAppError (#7283)
Diffstat (limited to 'utils/config.go')
-rw-r--r--utils/config.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/utils/config.go b/utils/config.go
index aa5b50146..af15c5e93 100644
--- a/utils/config.go
+++ b/utils/config.go
@@ -21,6 +21,7 @@ import (
"github.com/mattermost/platform/einterfaces"
"github.com/mattermost/platform/model"
+ "net/http"
)
const (
@@ -179,14 +180,14 @@ func SaveConfig(fileName string, config *model.Config) *model.AppError {
b, err := json.MarshalIndent(config, "", " ")
if err != nil {
- return model.NewLocAppError("SaveConfig", "utils.config.save_config.saving.app_error",
- map[string]interface{}{"Filename": fileName}, err.Error())
+ return model.NewAppError("SaveConfig", "utils.config.save_config.saving.app_error",
+ map[string]interface{}{"Filename": fileName}, err.Error(), http.StatusBadRequest)
}
err = ioutil.WriteFile(fileName, b, 0644)
if err != nil {
- return model.NewLocAppError("SaveConfig", "utils.config.save_config.saving.app_error",
- map[string]interface{}{"Filename": fileName}, err.Error())
+ return model.NewAppError("SaveConfig", "utils.config.save_config.saving.app_error",
+ map[string]interface{}{"Filename": fileName}, err.Error(), http.StatusInternalServerError)
}
return nil
@@ -592,12 +593,12 @@ func ValidateLocales(cfg *model.Config) *model.AppError {
locales := GetSupportedLocales()
if _, ok := locales[*cfg.LocalizationSettings.DefaultServerLocale]; !ok {
*cfg.LocalizationSettings.DefaultServerLocale = model.DEFAULT_LOCALE
- err = model.NewLocAppError("ValidateLocales", "utils.config.supported_server_locale.app_error", nil, "")
+ err = model.NewAppError("ValidateLocales", "utils.config.supported_server_locale.app_error", nil, "", http.StatusBadRequest)
}
if _, ok := locales[*cfg.LocalizationSettings.DefaultClientLocale]; !ok {
*cfg.LocalizationSettings.DefaultClientLocale = model.DEFAULT_LOCALE
- err = model.NewLocAppError("ValidateLocales", "utils.config.supported_client_locale.app_error", nil, "")
+ err = model.NewAppError("ValidateLocales", "utils.config.supported_client_locale.app_error", nil, "", http.StatusBadRequest)
}
if len(*cfg.LocalizationSettings.AvailableLocales) > 0 {
@@ -606,7 +607,7 @@ func ValidateLocales(cfg *model.Config) *model.AppError {
if _, ok := locales[word]; !ok {
*cfg.LocalizationSettings.AvailableLocales = ""
isDefaultClientLocaleInAvailableLocales = true
- err = model.NewLocAppError("ValidateLocales", "utils.config.supported_available_locales.app_error", nil, "")
+ err = model.NewAppError("ValidateLocales", "utils.config.supported_available_locales.app_error", nil, "", http.StatusBadRequest)
break
}
@@ -619,7 +620,7 @@ func ValidateLocales(cfg *model.Config) *model.AppError {
if !isDefaultClientLocaleInAvailableLocales {
availableLocales += "," + *cfg.LocalizationSettings.DefaultClientLocale
- err = model.NewLocAppError("ValidateLocales", "utils.config.add_client_locale.app_error", nil, "")
+ err = model.NewAppError("ValidateLocales", "utils.config.add_client_locale.app_error", nil, "", http.StatusBadRequest)
}
*cfg.LocalizationSettings.AvailableLocales = strings.Join(RemoveDuplicatesFromStringArray(strings.Split(availableLocales, ",")), ",")