Errors Standardization (#1246)

* errors and stuff

* more errors

* all the errors

* fix build
This commit is contained in:
Gus Caplan
2017-06-25 12:48:05 -05:00
committed by Amish Shah
parent 602fe06f88
commit 63e54982f4
28 changed files with 258 additions and 102 deletions

View File

@@ -6,6 +6,7 @@ const AudioPlayer = require('./player/AudioPlayer');
const VoiceReceiver = require('./receiver/VoiceReceiver');
const EventEmitter = require('events').EventEmitter;
const Prism = require('prism-media');
const { Error } = require('../../errors');
/**
* Represents a connection to a guild's voice server.
@@ -341,8 +342,8 @@ class VoiceConnection extends EventEmitter {
*/
connect() {
if (this.status !== Constants.VoiceStatus.RECONNECTING) {
if (this.sockets.ws) throw new Error('There is already an existing WebSocket connection.');
if (this.sockets.udp) throw new Error('There is already an existing UDP connection.');
if (this.sockets.ws) throw new Error('WS_CONNECTION_EXISTS');
if (this.sockets.udp) throw new Error('UDP_CONNECTION_EXISTS');
}
if (this.sockets.ws) this.sockets.ws.shutdown();