feat: mature error handling system

This commit is contained in:
TresAbhi committed 2023-06-06 16:50:33 +00:00
1 parent 1875f30cf5
commit 524edac615
23 files changed
+87 -87

No files matched your search

+5 -11
View File
@@ -1,6 +1,6 @@
import { CacheType, ChatInputCommandInteraction } from 'discord.js';
import { BlitzServer } from '../../constants/servers.js';
import negativeEmbed from '../interaction/negativeEmbed.js';
import errorWithCause from '../process/errorWithCause.js';
import { serverAndIdPattern } from './getBlitzAccount.js';
import listClansPanServer from './listClansPanServer.js';
@@ -17,16 +17,10 @@ export default async function getBlitzClan(
if (accounts[0]) {
return { server: accounts[0].server, id: accounts[0].clan_id };
} else {
await interaction.editReply({
embeds: [
negativeEmbed(
'Could not find clan',
`I couldn't find clan \`${clan}\`. Try selecting a username from the search result.`,
),
],
});
throw new Error(`Could not find clan "${clan}"`);
throw errorWithCause(
'Could not find clan',
`I couldn't find clan \`${clan}\`. Try selecting a username from the search result.`,
);
}
}
}