Throw errors in command handlers

This commit is contained in:
Max Isom 2022-01-26 22:30:58 -05:00
parent aacb107f43
commit 2e5e509b32
No known key found for this signature in database
GPG key ID: 25C9B1A7F6798880
11 changed files with 18 additions and 100 deletions

View file

@ -2,7 +2,6 @@ import {CommandInteraction} from 'discord.js';
import {TYPES} from '../types.js';
import {inject, injectable} from 'inversify';
import PlayerManager from '../managers/player.js';
import errorMsg from '../utils/error-msg.js';
import Command from '.';
import {SlashCommandBuilder} from '@discordjs/builders';
@ -24,11 +23,7 @@ export default class implements Command {
const player = this.playerManager.get(interaction.guild!.id);
if (player.isQueueEmpty()) {
await interaction.reply({
content: errorMsg('not enough songs to shuffle'),
ephemeral: true,
});
return;
throw new Error('not enough songs to shuffle');
}
player.shuffle();