chore: reporting
This commit is contained in:
parent
4133c55dbc
commit
dfbe25624e
|
@ -26,8 +26,7 @@ export default class Packet {
|
|||
return this.builder.encode(this.pack(data));
|
||||
}
|
||||
catch (error) {
|
||||
error.message = `${this.type}: ${error.message}`;
|
||||
throw error;
|
||||
throw new Error(`${this.type}: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,13 @@ export default class Socket {
|
|||
const packet = normalize(latus, packetOrDehydrated);
|
||||
const {constructor: Packet} = packet;
|
||||
debug('sending packet %s(%j)', Packet.type, packet.data);
|
||||
return socket[method](Packet.id, deflate(Packet.encode(packet.data)));
|
||||
try {
|
||||
const encoded = Packet.encode(packet.data);
|
||||
return socket[method](Packet.id, deflate(encoded));
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error(`${error.message}, data: ${JSON.stringify(packet.data, null, 2)}`);
|
||||
}
|
||||
}
|
||||
|
||||
send(packet) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user