summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-04-04 08:20:21 -0400
committerJoram Wilander <jwawilander@gmail.com>2016-04-04 08:20:21 -0400
commit785553384fe96027b0e9274b6ccc8623092eda70 (patch)
tree090fbe1061b61f7daa5335f1f6f9ae6ae1db4042 /store
parentd7f394a49b04e11eaf30b399cd0843963446eab9 (diff)
parentad902f601fa7570564df386bf1b03179b55242b5 (diff)
downloadchat-785553384fe96027b0e9274b6ccc8623092eda70.tar.gz
chat-785553384fe96027b0e9274b6ccc8623092eda70.tar.bz2
chat-785553384fe96027b0e9274b6ccc8623092eda70.zip
Merge pull request #2320 from mozilla/msg-command
PLT-2231 /msg command and tests
Diffstat (limited to 'store')
-rw-r--r--store/sql_channel_store.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go
index 35322e061..c7ffddd56 100644
--- a/store/sql_channel_store.go
+++ b/store/sql_channel_store.go
@@ -4,11 +4,16 @@
package store
import (
+ "database/sql"
"github.com/go-gorp/gorp"
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils"
)
+const (
+ MISSING_CHANNEL_ERROR = "store.sql_channel.get_by_name.missing.app_error"
+)
+
type SqlChannelStore struct {
*SqlStore
}
@@ -437,7 +442,11 @@ func (s SqlChannelStore) GetByName(teamId string, name string) StoreChannel {
channel := model.Channel{}
if err := s.GetReplica().SelectOne(&channel, "SELECT * FROM Channels WHERE TeamId = :TeamId AND Name= :Name AND DeleteAt = 0", map[string]interface{}{"TeamId": teamId, "Name": name}); err != nil {
- result.Err = model.NewLocAppError("SqlChannelStore.GetByName", "store.sql_channel.get_by_name.existing.app_error", nil, "teamId="+teamId+", "+"name="+name+", "+err.Error())
+ if err == sql.ErrNoRows {
+ result.Err = model.NewLocAppError("SqlChannelStore.GetByName", MISSING_CHANNEL_ERROR, nil, "teamId="+teamId+", "+"name="+name+", "+err.Error())
+ } else {
+ result.Err = model.NewLocAppError("SqlChannelStore.GetByName", "store.sql_channel.get_by_name.existing.app_error", nil, "teamId="+teamId+", "+"name="+name+", "+err.Error())
+ }
} else {
result.Data = &channel
}