diff options
author | George Goldberg <george@gberg.me> | 2017-09-01 16:42:02 +0100 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2017-09-01 11:42:02 -0400 |
commit | e85b5fb98835fb952eb2ed55f81e79eb3ef361ec (patch) | |
tree | abe78804cd5e1175954f74b811a6d6a7af089d0b /app/admin.go | |
parent | d9ec7d9240a508571904c22458222e2846c2b5b4 (diff) | |
download | chat-e85b5fb98835fb952eb2ed55f81e79eb3ef361ec.tar.gz chat-e85b5fb98835fb952eb2ed55f81e79eb3ef361ec.tar.bz2 chat-e85b5fb98835fb952eb2ed55f81e79eb3ef361ec.zip |
App: NewLocAppError -> NewAppError (#7327)
* App: NewLocAppError -> NewAppError
* Remove statuscode that got missed.
Diffstat (limited to 'app/admin.go')
-rw-r--r-- | app/admin.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/admin.go b/app/admin.go index b9e22a87f..6e6f8c604 100644 --- a/app/admin.go +++ b/app/admin.go @@ -17,6 +17,7 @@ import ( "github.com/mattermost/platform/model" "github.com/mattermost/platform/store" "github.com/mattermost/platform/utils" + "net/http" ) func GetLogs(page, perPage int) ([]string, *model.AppError) { @@ -57,7 +58,7 @@ func GetLogsSkipSend(page, perPage int) ([]string, *model.AppError) { if utils.Cfg.LogSettings.EnableFile { file, err := os.Open(utils.GetLogFileLocation(utils.Cfg.LogSettings.FileLocation)) if err != nil { - return nil, model.NewLocAppError("getLogs", "api.admin.file_read_error", nil, err.Error()) + return nil, model.NewAppError("getLogs", "api.admin.file_read_error", nil, err.Error(), http.StatusInternalServerError) } defer file.Close() @@ -153,7 +154,7 @@ func SaveConfig(cfg *model.Config, sendConfigChangeClusterMessage bool) *model.A } if *utils.Cfg.ClusterSettings.Enable && *utils.Cfg.ClusterSettings.ReadOnlyConfig { - return model.NewLocAppError("saveConfig", "ent.cluster.save_config.error", nil, "") + return model.NewAppError("saveConfig", "ent.cluster.save_config.error", nil, "", http.StatusForbidden) } utils.DisableConfigWatch() @@ -198,7 +199,7 @@ func RecycleDatabaseConnection() { func TestEmail(userId string, cfg *model.Config) *model.AppError { if len(cfg.EmailSettings.SMTPServer) == 0 { - return model.NewLocAppError("testEmail", "api.admin.test_email.missing_server", nil, utils.T("api.context.invalid_param.app_error", map[string]interface{}{"Name": "SMTPServer"})) + return model.NewAppError("testEmail", "api.admin.test_email.missing_server", nil, utils.T("api.context.invalid_param.app_error", map[string]interface{}{"Name": "SMTPServer"}), http.StatusBadRequest) } // if the user hasn't changed their email settings, fill in the actual SMTP password so that @@ -209,7 +210,7 @@ func TestEmail(userId string, cfg *model.Config) *model.AppError { cfg.EmailSettings.SMTPUsername == utils.Cfg.EmailSettings.SMTPUsername { cfg.EmailSettings.SMTPPassword = utils.Cfg.EmailSettings.SMTPPassword } else { - return model.NewLocAppError("testEmail", "api.admin.test_email.reenter_password", nil, "") + return model.NewAppError("testEmail", "api.admin.test_email.reenter_password", nil, "", http.StatusBadRequest) } } if user, err := GetUser(userId); err != nil { |