From 95173b95f796a1a2bce718faf1f66a6428e8252d Mon Sep 17 00:00:00 2001 From: diamondburned Date: Tue, 23 Apr 2024 23:06:35 -0700 Subject: [PATCH] gateway: Add event op + type to unmarshal error --- utils/ws/codec.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/ws/codec.go b/utils/ws/codec.go index eaf0734..ea28681 100644 --- a/utils/ws/codec.go +++ b/utils/ws/codec.go @@ -90,7 +90,10 @@ func (c Codec) DecodeInto(ctx context.Context, r io.Reader, buf *DecodeBuffer, o op.Op.Data = fn() if err := op.Data.UnmarshalTo(op.Op.Data); err != nil { - return c.send(ctx, out, newErrOp(err, "cannot unmarshal JSON data from gateway")) + return c.send(ctx, out, newErrOp(err, fmt.Sprintf( + "cannot unmarshal JSON event (op %d type %q) from gateway", + op.Code, op.Type, + ))) } return c.send(ctx, out, op.Op)