From 9ce24f5fab5c181bc2b540334b8adce56ef0a39b Mon Sep 17 00:00:00 2001 From: "aaron@nanu-c.org" Date: Thu, 27 Jan 2022 22:57:41 +0100 Subject: [PATCH] better error handling for receiving messages --- crayfish/backend.go | 1 + websocket.go | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/crayfish/backend.go b/crayfish/backend.go index 66f71c8..07df7ec 100644 --- a/crayfish/backend.go +++ b/crayfish/backend.go @@ -573,6 +573,7 @@ func (c *CrayfishInstance) HandleEnvelope(msg []byte) (*CrayfishWebSocketRespons log.Debugf("[textsecure-crayfish-ws] HandleEnvelope recieved an response") rm, err := json.Marshal(response.Message) if err != nil { + log.Errorln("[textsecure-crayfish-ws] failed to marshal response message", response.Message) return nil, err } var data CrayfishWebSocketResponse_HANDLE_ENVELOPE_MESSAGE diff --git a/websocket.go b/websocket.go index 7685c55..c5b8755 100644 --- a/websocket.go +++ b/websocket.go @@ -188,9 +188,14 @@ func StartListening() error { if err != nil { log.WithFields(log.Fields{ "error": err, - }).Error("[textsecure] Failed to handle received message") + }).Error("[textsecure] Failed to decrypt received message") } else { - env, _ := createEnvelope(plaintext) + env, err := createEnvelope(plaintext) + if err != nil { + log.WithFields(log.Fields{ + "error": err, + }).Error("[textsecure] Failed to create envelope") + } err = handleReceivedMessage(env) if err != nil { log.WithFields(log.Fields{