From a2754f15fc2bc2eede94e2e41712f9f0585f2426 Mon Sep 17 00:00:00 2001 From: Duco van Amstel Date: Sat, 8 Dec 2018 16:04:10 +0000 Subject: Enable errcheck linter (#646) --- matterclient/helpers.go | 3 +-- matterclient/matterclient.go | 4 +++- matterclient/messages.go | 8 ++++++-- 3 files changed, 10 insertions(+), 5 deletions(-) (limited to 'matterclient') diff --git a/matterclient/helpers.go b/matterclient/helpers.go index 05497311..625fffaa 100644 --- a/matterclient/helpers.go +++ b/matterclient/helpers.go @@ -263,8 +263,7 @@ func (m *MMClient) sendWSRequest(action string, data map[string]interface{}) err req.Data = data m.WsSequence++ m.log.Debugf("sendWsRequest %#v", req) - m.WsClient.WriteJSON(req) - return nil + return m.WsClient.WriteJSON(req) } func supportedVersion(version string) bool { diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go index 4997011b..f15b1d1b 100644 --- a/matterclient/matterclient.go +++ b/matterclient/matterclient.go @@ -208,7 +208,9 @@ func (m *MMClient) StatusLoop() { return } if m.WsConnected { - m.checkAlive() + if err := m.checkAlive(); err != nil { + log.Errorf("Connection is not alive: %#v", err) + } select { case <-m.WsPingChan: m.log.Debug("WS PONG received") diff --git a/matterclient/messages.go b/matterclient/messages.go index 28e3ec28..985cfe04 100644 --- a/matterclient/messages.go +++ b/matterclient/messages.go @@ -53,7 +53,9 @@ func (m *MMClient) parseMessage(rmsg *Message) { m.UpdateUser(user["id"].(string)) } case "group_added": - m.UpdateChannels() + if err := m.UpdateChannels(); err != nil { + m.log.Errorf("failed to update channels: %#v", err) + } /* case model.ACTION_USER_REMOVED: m.handleWsActionUserRemoved(&rmsg) @@ -186,7 +188,9 @@ func (m *MMClient) SendDirectMessageProps(toUserId string, msg string, props map channelName := model.GetDMNameFromIds(toUserId, m.User.Id) // update our channels - m.UpdateChannels() + if err := m.UpdateChannels(); err != nil { + m.log.Errorf("failed to update channels: %#v", err) + } // build & send the message msg = strings.Replace(msg, "\r", "", -1) -- cgit v1.2.3