mirror of
https://github.com/danbulant/discord.js
synced 2026-07-08 20:51:14 +00:00
Replace a few rejections with throw (#590)
This commit is contained in:
parent
44b34154e8
commit
64d89b3748
2 changed files with 2 additions and 4 deletions
|
|
@ -196,8 +196,7 @@ class ClientDataResolver {
|
||||||
const file = path.resolve(resource);
|
const file = path.resolve(resource);
|
||||||
const stat = fs.statSync(file);
|
const stat = fs.statSync(file);
|
||||||
if (!stat.isFile()) {
|
if (!stat.isFile()) {
|
||||||
reject(new Error(`The file could not be found: ${file}`));
|
throw new Error(`The file could not be found: ${file}`);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.readFile(file, (err, data) => {
|
fs.readFile(file, (err, data) => {
|
||||||
|
|
|
||||||
|
|
@ -104,8 +104,7 @@ class ClientVoiceManager {
|
||||||
joinChannel(channel) {
|
joinChannel(channel) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (this.pending.get(channel.guild.id)) {
|
if (this.pending.get(channel.guild.id)) {
|
||||||
reject(new Error('already connecting to a channel in this guild'));
|
throw new Error('already connecting to a channel in this guild');
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
const existingConn = this.connections.get(channel.guild.id);
|
const existingConn = this.connections.get(channel.guild.id);
|
||||||
if (existingConn) {
|
if (existingConn) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue