summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2016-01-20 14:36:34 -0600
committer=Corey Hulen <corey@hulen.com>2016-01-20 14:36:34 -0600
commit984fa7f1ca1b582f77cc511156e9747b175203e5 (patch)
treef793e0240c4a21b4daeb6cac7dd011c6020d0af2 /api
parentd703d09063538fb91baa5a21b1001216c43d848a (diff)
downloadchat-984fa7f1ca1b582f77cc511156e9747b175203e5.tar.gz
chat-984fa7f1ca1b582f77cc511156e9747b175203e5.tar.bz2
chat-984fa7f1ca1b582f77cc511156e9747b175203e5.zip
PLT-7-server-db
Diffstat (limited to 'api')
-rw-r--r--api/admin.go2
-rw-r--r--api/api_test.go1
-rw-r--r--api/context.go3
3 files changed, 4 insertions, 2 deletions
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
}