mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(WebSocketShard): add websocket send error handling (#2981)
* websocket send error handling * fix: emit only when error is present * refactor: use an if instead
This commit is contained in:
@@ -437,7 +437,9 @@ class WebSocketShard extends EventEmitter {
|
||||
this.debug(`Tried to send packet ${data} but no WebSocket is available!`);
|
||||
return;
|
||||
}
|
||||
this.ws.send(WebSocket.pack(data));
|
||||
this.ws.send(WebSocket.pack(data), err => {
|
||||
if (err) this.manager.client.emit(Events.ERROR, err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,6 +13,7 @@ client.on('ready', () => {
|
||||
log('READY', client.user.tag, client.user.id);
|
||||
});
|
||||
client.on('rateLimit', log);
|
||||
client.on('error', console.error);
|
||||
|
||||
const commands = {
|
||||
eval: message => {
|
||||
|
||||
Reference in New Issue
Block a user