mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
Handle 4011 ws event code (#1083)
* 4011 * Update WebSocketManager.js * smh gawdl3y
This commit is contained in:
@@ -35,6 +35,7 @@ class ClientManager {
|
||||
this.client.ws.once('close', event => {
|
||||
if (event.code === 4004) reject(new Error(Constants.Errors.BAD_LOGIN));
|
||||
if (event.code === 4010) reject(new Error(Constants.Errors.INVALID_SHARD));
|
||||
if (event.code === 4011) reject(new Error(Constants.Errors.SHARDING_REQUIRED));
|
||||
});
|
||||
this.client.once(Constants.Events.READY, () => {
|
||||
resolve(token);
|
||||
|
||||
@@ -249,8 +249,7 @@ class WebSocketManager extends EventEmitter {
|
||||
* @param {CloseEvent} event The WebSocket close event
|
||||
*/
|
||||
if (!this.reconnecting) this.client.emit(Constants.Events.DISCONNECT, event);
|
||||
if (event.code === 4004) return;
|
||||
if (event.code === 4010) return;
|
||||
if ([4004, 4010, 4011].includes(event.code)) return;
|
||||
if (!this.reconnecting && event.code !== 1000) this.tryReconnect();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user