From 64d89b37489c6d3b08412accad055c9c69175c4b Mon Sep 17 00:00:00 2001 From: Schuyler Cebulskie Date: Sat, 3 Sep 2016 16:36:54 -0400 Subject: [PATCH] Replace a few rejections with throw (#590) --- src/client/ClientDataResolver.js | 3 +-- src/client/voice/ClientVoiceManager.js | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/client/ClientDataResolver.js b/src/client/ClientDataResolver.js index cf8d77b25..6ba335e05 100644 --- a/src/client/ClientDataResolver.js +++ b/src/client/ClientDataResolver.js @@ -196,8 +196,7 @@ class ClientDataResolver { const file = path.resolve(resource); const stat = fs.statSync(file); if (!stat.isFile()) { - reject(new Error(`The file could not be found: ${file}`)); - return; + throw new Error(`The file could not be found: ${file}`); } fs.readFile(file, (err, data) => { diff --git a/src/client/voice/ClientVoiceManager.js b/src/client/voice/ClientVoiceManager.js index 82ba39824..3120c4e0a 100644 --- a/src/client/voice/ClientVoiceManager.js +++ b/src/client/voice/ClientVoiceManager.js @@ -104,8 +104,7 @@ class ClientVoiceManager { joinChannel(channel) { return new Promise((resolve, reject) => { if (this.pending.get(channel.guild.id)) { - reject(new Error('already connecting to a channel in this guild')); - return; + throw new Error('already connecting to a channel in this guild'); } const existingConn = this.connections.get(channel.guild.id); if (existingConn) {