diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-31 13:58:38 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-31 13:58:38 -0400 |
commit | 534aed7f7cd700cc83a9d61f928bba6628e05c86 (patch) | |
tree | 66e8d883e78540151a1e2092f474c53b692af55e /src/lib/extensions | |
parent | edcc0dd0a9228192ff6c4f6d6797dd6238e98f92 (diff) | |
download | tanzanite-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.ts | 10 |
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.'); } } |