summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2016-02-01 18:52:43 -0800
committer=Corey Hulen <corey@hulen.com>2016-02-01 18:52:43 -0800
commit27586a320add265f3e032d2cb21b27e93b51a2b0 (patch)
tree5158d1ffeb0f3a922b0036f560b3c99862373275 /store
parentb4ec6900510077253290e361d1a706e5368a45de (diff)
downloadchat-27586a320add265f3e032d2cb21b27e93b51a2b0.tar.gz
chat-27586a320add265f3e032d2cb21b27e93b51a2b0.tar.bz2
chat-27586a320add265f3e032d2cb21b27e93b51a2b0.zip
Adding loc to new command backend
Diffstat (limited to 'store')
-rw-r--r--store/sql_command_store.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/store/sql_command_store.go b/store/sql_command_store.go
index cb817d8f8..760235e10 100644
--- a/store/sql_command_store.go
+++ b/store/sql_command_store.go
@@ -47,8 +47,7 @@ func (s SqlCommandStore) Save(command *model.Command) StoreChannel {
result := StoreResult{}
if len(command.Id) > 0 {
- result.Err = model.NewAppError("SqlCommandStore.Save",
- "You cannot overwrite an existing Command", "id="+command.Id)
+ result.Err = model.NewLocAppError("SqlCommandStore.Save", "store.sql_command.save.saving_overwrite.app_error", nil, "id="+command.Id)
storeChannel <- result
close(storeChannel)
return
@@ -62,7 +61,7 @@ func (s SqlCommandStore) Save(command *model.Command) StoreChannel {
}
if err := s.GetMaster().Insert(command); err != nil {
- result.Err = model.NewAppError("SqlCommandStore.Save", "We couldn't save the Command", "id="+command.Id+", "+err.Error())
+ result.Err = model.NewLocAppError("SqlCommandStore.Save", "store.sql_command.save.saving.app_error", nil, "id="+command.Id+", "+err.Error())
} else {
result.Data = command
}
@@ -83,7 +82,7 @@ func (s SqlCommandStore) Get(id string) StoreChannel {
var command model.Command
if err := s.GetReplica().SelectOne(&command, "SELECT * FROM Commands WHERE Id = :Id AND DeleteAt = 0", map[string]interface{}{"Id": id}); err != nil {
- result.Err = model.NewAppError("SqlCommandStore.Get", "We couldn't get the command", "id="+id+", err="+err.Error())
+ result.Err = model.NewLocAppError("SqlCommandStore.Get", "store.sql_command.save.get.app_error", nil, "id="+id+", err="+err.Error())
}
result.Data = &command
@@ -104,7 +103,7 @@ func (s SqlCommandStore) GetByTeam(teamId string) StoreChannel {
var commands []*model.Command
if _, err := s.GetReplica().Select(&commands, "SELECT * FROM Commands WHERE TeamId = :TeamId AND DeleteAt = 0", map[string]interface{}{"TeamId": teamId}); err != nil {
- result.Err = model.NewAppError("SqlCommandStore.GetByTeam", "We couldn't get the commands", "teamId="+teamId+", err="+err.Error())
+ result.Err = model.NewLocAppError("SqlCommandStore.GetByTeam", "store.sql_command.save.get_team.app_error", nil, "teamId="+teamId+", err="+err.Error())
}
result.Data = commands
@@ -124,7 +123,7 @@ func (s SqlCommandStore) Delete(commandId string, time int64) StoreChannel {
_, err := s.GetMaster().Exec("Update Commands SET DeleteAt = :DeleteAt, UpdateAt = :UpdateAt WHERE Id = :Id", map[string]interface{}{"DeleteAt": time, "UpdateAt": time, "Id": commandId})
if err != nil {
- result.Err = model.NewAppError("SqlCommandStore.Delete", "We couldn't delete the command", "id="+commandId+", err="+err.Error())
+ result.Err = model.NewLocAppError("SqlCommandStore.Delete", "store.sql_command.save.delete.app_error", nil, "id="+commandId+", err="+err.Error())
}
storeChannel <- result
@@ -142,7 +141,7 @@ func (s SqlCommandStore) PermanentDeleteByUser(userId string) StoreChannel {
_, err := s.GetMaster().Exec("DELETE FROM Commands WHERE CreatorId = :UserId", map[string]interface{}{"UserId": userId})
if err != nil {
- result.Err = model.NewAppError("SqlCommandStore.DeleteByUser", "We couldn't delete the command", "id="+userId+", err="+err.Error())
+ result.Err = model.NewLocAppError("SqlCommandStore.DeleteByUser", "store.sql_command.save.delete_perm.app_error", nil, "id="+userId+", err="+err.Error())
}
storeChannel <- result
@@ -161,7 +160,7 @@ func (s SqlCommandStore) Update(hook *model.Command) StoreChannel {
hook.UpdateAt = model.GetMillis()
if _, err := s.GetMaster().Update(hook); err != nil {
- result.Err = model.NewAppError("SqlCommandStore.Update", "We couldn't update the command", "id="+hook.Id+", "+err.Error())
+ result.Err = model.NewLocAppError("SqlCommandStore.Update", "store.sql_command.save.update.app_error", nil, "id="+hook.Id+", "+err.Error())
} else {
result.Data = hook
}