mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 03:29:51 +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,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.',
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
export default function errorWithCause(message: string, cause: string) {
|
||||
return new Error(message, { cause });
|
||||
}
|
||||
Reference in new issue
Block a user