Handle errors in initUser()

This commit is contained in:
Wim 2017-01-06 23:51:44 +01:00
parent e3dda0e812
commit 77f1a959c3

View File

@ -622,11 +622,20 @@ func (m *MMClient) initUser() error {
//m.log.Debug("initUser(): loading all team data") //m.log.Debug("initUser(): loading all team data")
for _, v := range initData.Teams { for _, v := range initData.Teams {
m.Client.SetTeamId(v.Id) m.Client.SetTeamId(v.Id)
mmusers, _ := m.Client.GetProfiles(0, 50000, "") mmusers, err := m.Client.GetProfiles(0, 50000, "")
if err != nil {
return errors.New(err.DetailedError)
}
t := &Team{Team: v, Users: mmusers.Data.(map[string]*model.User), Id: v.Id} t := &Team{Team: v, Users: mmusers.Data.(map[string]*model.User), Id: v.Id}
mmchannels, _ := m.Client.GetChannels("") mmchannels, err := m.Client.GetChannels("")
if err != nil {
return errors.New(err.DetailedError)
}
t.Channels = mmchannels.Data.(*model.ChannelList) t.Channels = mmchannels.Data.(*model.ChannelList)
mmchannels, _ = m.Client.GetMoreChannels("") mmchannels, err = m.Client.GetMoreChannels("")
if err != nil {
return errors.New(err.DetailedError)
}
t.MoreChannels = mmchannels.Data.(*model.ChannelList) t.MoreChannels = mmchannels.Data.(*model.ChannelList)
m.OtherTeams = append(m.OtherTeams, t) m.OtherTeams = append(m.OtherTeams, t)
if v.Name == m.Credentials.Team { if v.Name == m.Credentials.Team {