Allow await endpoint stage to not error (#1444)

This commit is contained in:
aemino
2017-05-01 10:01:28 -07:00
committed by Amish Shah
parent fccd0bd183
commit 2bf8a36077

View File

@@ -169,19 +169,20 @@ class VoiceConnection extends EventEmitter {
* @returns {void} * @returns {void}
*/ */
setTokenAndEndpoint(token, endpoint) { setTokenAndEndpoint(token, endpoint) {
if (!token) { if (!endpoint) {
this.authenticateFailed('Token not provided from voice server packet.'); // Signifies awaiting endpoint stage
return; return;
} }
if (!endpoint) {
this.authenticateFailed('Endpoint not provided from voice server packet.'); if (!token) {
this.authenticateFailed('Token not provided from voice server packet.');
return; return;
} }
endpoint = endpoint.match(/([^:]*)/)[0]; endpoint = endpoint.match(/([^:]*)/)[0];
if (!endpoint) { if (!endpoint) {
this.authenticateFailed('Failed to find an endpoint.'); this.authenticateFailed('Invalid endpoint received.');
return; return;
} }