Skip to content

Commit

Permalink
gateway: Add event op + type to unmarshal error
Browse files Browse the repository at this point in the history
  • Loading branch information
diamondburned committed Apr 24, 2024
1 parent 2fb6883 commit 95173b9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion utils/ws/codec.go
Expand Up @@ -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)
Expand Down

0 comments on commit 95173b9

Please sign in to comment.