fix(Client): login not properly rejecting on invalid token

This commit is contained in:
Lewdcario
2018-06-29 19:28:21 -05:00
parent 3fa9ed1f42
commit 448f38429d
3 changed files with 8 additions and 3 deletions

View File

@@ -43,6 +43,7 @@ class ClientManager {
const gateway = `${res.url}/?v=${protocolVersion}&encoding=${WebSocketConnection.ENCODING}`;
this.client.emit(Constants.Events.DEBUG, `Using gateway ${gateway}`);
this.client.ws.connect(gateway);
this.client.ws.connection.once('error', reject);
this.client.ws.connection.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));