mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: improved error messages
This commit is contained in:
1 parent
890a4d142b
commit
4c746cbb86
6 files changed
+32
-25
No files matched your search
@@ -18,9 +18,10 @@ export default async function resolveClanFromCommand(
|
||||
if (accounts[0]) {
|
||||
return { region: accounts[0].region, id: accounts[0].clan_id };
|
||||
} else {
|
||||
throw new UserError('Could not find clan', {
|
||||
cause: `I couldn't find clan \`${clan}\`. Try selecting a username from the search result.`,
|
||||
});
|
||||
throw new UserError(
|
||||
'Could not find clan',
|
||||
`\`${clan}\` was not found. Try selecting a clan from the search result.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,11 +34,12 @@ export default async function resolvePlayerFromCommand(
|
||||
id: accounts[0].account_id,
|
||||
} satisfies ResolvedPlayer;
|
||||
} else {
|
||||
throw new UserError('Could not find user', {
|
||||
cause: `I couldn't find user "${markdownEscape(
|
||||
throw new UserError(
|
||||
'Could not find user',
|
||||
`I couldn't find user "${markdownEscape(
|
||||
commandUsername,
|
||||
)}". Try picking an user from the search result, typing in a valid username, or using the \`/link\` command.`,
|
||||
});
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -47,9 +48,10 @@ export default async function resolvePlayerFromCommand(
|
||||
if (account) {
|
||||
return { region: account.region, id: account.blitz };
|
||||
} else {
|
||||
throw new UserError('Use the `/link` command', {
|
||||
cause: 'Link your Blitz and Discord accounts to get started.',
|
||||
});
|
||||
throw new UserError(
|
||||
"You're account isn't linked with Blitzkrieg yet",
|
||||
'Use the `/link` command to get started.', // TODO: add shortcut button too
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user