From 567db393ac9b1cd3acb86d09cb864e940bfc33d2 Mon Sep 17 00:00:00 2001 From: kaichaosun Date: Thu, 4 Dec 2025 10:45:16 +0800 Subject: [PATCH] fix: no error when decode failure --- src/chat/client.nim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/chat/client.nim b/src/chat/client.nim index 75ad3c0..8fcfed3 100644 --- a/src/chat/client.nim +++ b/src/chat/client.nim @@ -234,9 +234,11 @@ proc newPrivateConversation*(client: Client, proc parseMessage(client: Client, msg: ChatPayload) {.raises: [ValueError, SerializationError].} = ## Receives a incoming payload, decodes it, and processes it. - - let envelope = decode(msg.bytes, WapEnvelopeV1).valueOr: - raise newException(ValueError, "Failed to decode WapEnvelopeV1: " & error) + let envelopeRes = decode(msg.bytes, WapEnvelopeV1) + if envelopeRes.isErr: + debug "Failed to decode WapEnvelopeV1", err = envelopeRes.error + return + let envelope = envelopeRes.get() let convo = block: let opt = client.getConversationFromHint(envelope.conversationHint).valueOr: