Skip to content

Commit 567db39

Browse files
committed
fix: no error when decode failure
1 parent 76e65f4 commit 567db39

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/chat/client.nim

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,11 @@ proc newPrivateConversation*(client: Client,
234234
proc parseMessage(client: Client, msg: ChatPayload) {.raises: [ValueError,
235235
SerializationError].} =
236236
## Receives a incoming payload, decodes it, and processes it.
237-
238-
let envelope = decode(msg.bytes, WapEnvelopeV1).valueOr:
239-
raise newException(ValueError, "Failed to decode WapEnvelopeV1: " & error)
237+
let envelopeRes = decode(msg.bytes, WapEnvelopeV1)
238+
if envelopeRes.isErr:
239+
debug "Failed to decode WapEnvelopeV1", err = envelopeRes.error
240+
return
241+
let envelope = envelopeRes.get()
240242

241243
let convo = block:
242244
let opt = client.getConversationFromHint(envelope.conversationHint).valueOr:

0 commit comments

Comments
 (0)