From 984fa7f1ca1b582f77cc511156e9747b175203e5 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Wed, 20 Jan 2016 14:36:34 -0600 Subject: PLT-7-server-db --- api/admin.go | 2 +- api/api_test.go | 1 + api/context.go | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'api') diff --git a/api/admin.go b/api/admin.go index 61741b445..72a95ba6a 100644 --- a/api/admin.go +++ b/api/admin.go @@ -41,7 +41,7 @@ func getLogs(c *Context, w http.ResponseWriter, r *http.Request) { file, err := os.Open(utils.GetLogFileLocation(utils.Cfg.LogSettings.FileLocation)) if err != nil { - c.Err = model.NewAppError("getLogs", c.T("api.admin.file_read_error"), err.Error()) + c.Err = model.NewLocAppError("getLogs", "api.admin.file_read_error", nil, err.Error()) } defer file.Close() diff --git a/api/api_test.go b/api/api_test.go index 2ef4e196d..4d7192e4b 100644 --- a/api/api_test.go +++ b/api/api_test.go @@ -14,6 +14,7 @@ var Client *model.Client func Setup() { if Srv == nil { utils.LoadConfig("config.json") + utils.InitTranslations() utils.Cfg.TeamSettings.MaxUsersPerTeam = 50 NewServer() StartServer() diff --git a/api/context.go b/api/context.go index b6ffb1a29..a3311a971 100644 --- a/api/context.go +++ b/api/context.go @@ -206,6 +206,7 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } if c.Err != nil { + c.Err.Translate(c.T) c.Err.RequestId = c.RequestId c.LogError(c.Err) c.Err.Where = r.URL.Path @@ -373,7 +374,7 @@ func (c *Context) RemoveSessionCookie(w http.ResponseWriter, r *http.Request) { } func (c *Context) SetInvalidParam(where string, name string) { - c.Err = model.NewAppError(where, "Invalid "+name+" parameter", "") + c.Err = model.NewLocAppError(where, "api.context.invalid_param", map[string]interface{}{"Name": name}, "") c.Err.StatusCode = http.StatusBadRequest } -- cgit v1.2.3-1-g7c22