aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-31 13:58:38 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-31 13:58:38 -0400
commit534aed7f7cd700cc83a9d61f928bba6628e05c86 (patch)
tree66e8d883e78540151a1e2092f474c53b692af55e /src/lib/extensions
parentedcc0dd0a9228192ff6c4f6d6797dd6238e98f92 (diff)
downloadtanzanite-534aed7f7cd700cc83a9d61f928bba6628e05c86.tar.gz
tanzanite-534aed7f7cd700cc83a9d61f928bba6628e05c86.tar.bz2
tanzanite-534aed7f7cd700cc83a9d61f928bba6628e05c86.zip
throw error objects instead of strings
Diffstat (limited to 'src/lib/extensions')
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts
index ac39611..cf8364e 100644
--- a/src/lib/extensions/discord-akairo/BushClientUtil.ts
+++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts
@@ -314,7 +314,7 @@ export class BushClientUtil extends ClientUtil {
const style = Constants.MessageButtonStyles.PRIMARY;
let curPage = 0;
- if (typeof embeds !== 'object') throw 'embeds must be an object';
+ if (typeof embeds !== 'object') throw new Error('embeds must be an object');
const msg: Message = await message.util.reply({
content: text || null,
embeds: [embeds[curPage]],
@@ -628,7 +628,7 @@ export class BushClientUtil extends ClientUtil {
if (!victim.guild && ['ban', 'unban'].includes(type)) return true;
if (moderator.guild.id !== victim.guild.id) {
- throw 'moderator and victim not in same guild';
+ throw new Error('moderator and victim not in same guild');
}
const isOwner = moderator.guild.ownerId === moderator.id;
if (moderator.id === victim.id) {
@@ -768,16 +768,16 @@ export class BushClientUtil extends ClientUtil {
if (raw.statusCode == 200) {
profile = JSON.parse(raw.body);
} else {
- throw 'invalid player';
+ throw new Error('invalid player');
}
if (raw.statusCode == 200 && profile && profile.uuid) {
return profile.uuid.replace(/-/g, '');
} else {
- throw `Could not fetch the uuid for ${player}.`;
+ throw new Error(`Could not fetch the uuid for ${player}.`);
}
} catch (e) {
- throw 'An error has occurred.';
+ throw new Error('An error has occurred.');
}
}