1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-27 09:12:53 +00:00

gateway: Add event op + type to unmarshal error

This commit is contained in:
diamondburned 2024-04-23 23:06:35 -07:00
parent 2fb68833e9
commit 95173b95f7
No known key found for this signature in database
GPG key ID: D78C4471CE776659

View file

@ -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)