fix(WebSocketConnection): stringify data when no websocket is available

[object Object] is not really descriptive
This commit is contained in:
SpaceEEC 2019-05-04 21:00:49 +02:00
parent 12e041bc2b
commit 60013b7a10
No known key found for this signature in database
GPG key ID: 8C8A2E338661B871

View file

@ -212,7 +212,7 @@ class WebSocketConnection extends EventEmitter {
*/
_send(data) {
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
this.debug(`Tried to send packet ${data} but no WebSocket is available!`);
this.debug(`Tried to send packet ${JSON.stringify(data)} but no WebSocket is available!`);
return;
}
this.ws.send(this.pack(data));
@ -225,7 +225,7 @@ class WebSocketConnection extends EventEmitter {
*/
send(data) {
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
this.debug(`Tried to send packet ${data} but no WebSocket is available!`);
this.debug(`Tried to send packet ${JSON.stringify(data)} but no WebSocket is available!`);
return;
}
this.ratelimit.queue.push(data);