Add more error checking

This commit is contained in:
Wim 2017-02-03 16:43:21 +01:00
parent 6e772ee189
commit e1a5f5bca5
1 changed files with 6 additions and 1 deletions

View File

@ -470,11 +470,16 @@ func (m *MMClient) SendDirectMessage(toUserId string, msg string) {
_, err := m.Client.CreateDirectChannel(toUserId) _, err := m.Client.CreateDirectChannel(toUserId)
if err != nil { if err != nil {
m.log.Debugf("SendDirectMessage to %#v failed: %s", toUserId, err) m.log.Debugf("SendDirectMessage to %#v failed: %s", toUserId, err)
return
} }
channelName := model.GetDMNameFromIds(toUserId, m.User.Id) channelName := model.GetDMNameFromIds(toUserId, m.User.Id)
// update our channels // update our channels
mmchannels, _ := m.Client.GetChannels("") mmchannels, err := m.Client.GetChannels("")
if err != nil {
m.log.Debug("SendDirectMessage: Couldn't update channels")
return
}
m.Lock() m.Lock()
m.Team.Channels = mmchannels.Data.(*model.ChannelList) m.Team.Channels = mmchannels.Data.(*model.ChannelList)
m.Unlock() m.Unlock()