mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
feat: mature error handling system
This commit is contained in:
1 parent
1875f30cf5
commit
524edac615
23 files changed
+87
-87
No files matched your search
@@ -1,8 +1,8 @@
|
||||
import { CacheType, ChatInputCommandInteraction } from 'discord.js';
|
||||
import { BLITZ_SERVERS, BlitzServer } from '../../constants/servers.js';
|
||||
import { TanksStats } from '../../types/tanksStats.js';
|
||||
import negativeEmbed from '../interaction/negativeEmbed.js';
|
||||
import { args } from '../process/args.js';
|
||||
import errorWithCause from '../process/errorWithCause.js';
|
||||
import getWargamingResponse from './getWargamingResponse.js';
|
||||
|
||||
export default async function getTankStats(
|
||||
@@ -15,16 +15,10 @@ export default async function getTankStats(
|
||||
);
|
||||
|
||||
if (tankStats[id] === null) {
|
||||
interaction.editReply({
|
||||
embeds: [
|
||||
negativeEmbed(
|
||||
'No tank stats available',
|
||||
`Wargaming says there is no tank stats for this account. This account may not have any battles/tanks or exist in the ${BLITZ_SERVERS[server]} server.`,
|
||||
),
|
||||
],
|
||||
});
|
||||
|
||||
throw new Error(`No tank stats available for ${server}/${id}`);
|
||||
throw errorWithCause(
|
||||
'No tank stats available',
|
||||
`Wargaming says there is no tank stats for this account. This account may not have any battles/tanks or exist in the ${BLITZ_SERVERS[server]} server.`,
|
||||
);
|
||||
}
|
||||
|
||||
return tankStats[id];
|
||||
|
||||
Reference in new issue
Block a user