summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
authorAlan Mooiman <amooiman@gmail.com>2016-03-24 22:42:03 -0400
committerAlan Mooiman <amooiman@gmail.com>2016-03-24 23:45:15 -0400
commitad902f601fa7570564df386bf1b03179b55242b5 (patch)
tree8904076d6ebbae1c93b53c899b9c06b4520774d8 /store
parent8f5b90fe7858de03ac055b38ab7aaec5f54fa107 (diff)
downloadchat-ad902f601fa7570564df386bf1b03179b55242b5.tar.gz
chat-ad902f601fa7570564df386bf1b03179b55242b5.tar.bz2
chat-ad902f601fa7570564df386bf1b03179b55242b5.zip
msg command
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
}