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 -1
View File
@@ -1,4 +1,5 @@
import { argv } from 'process';
import errorWithCause from './errorWithCause.js';
type ArgumentName = 'discord-token' | 'wargaming-application-id';
@@ -16,6 +17,9 @@ argv.forEach((arg) => {
Object.keys(args).forEach((arg) => {
if (args[arg as ArgumentName] === '') {
throw new Error(`Missing argument: ${arg}`);
throw errorWithCause(
`Missing argument: ${arg}`,
'Missing required auth key.',
);
}
});