fix(logging): made fatal errors exit out of program
This commit is contained in:
parent
c418cbbc90
commit
1ae3f8de10
3 changed files with 5 additions and 1 deletions
|
@ -28,7 +28,7 @@
|
||||||
"run:dev": "NODE_CONFIG_ENV=dev node dist/src/index.js",
|
"run:dev": "NODE_CONFIG_ENV=dev node dist/src/index.js",
|
||||||
"run:prod": "NODE_CONFIG_ENV=production node dist/index.js",
|
"run:prod": "NODE_CONFIG_ENV=production node dist/index.js",
|
||||||
"test": "NODE_CONFIG_ENV=tests mocha -r ts-node/register -r tsconfig-paths/register tests/**/*.test.ts",
|
"test": "NODE_CONFIG_ENV=tests mocha -r ts-node/register -r tsconfig-paths/register tests/**/*.test.ts",
|
||||||
"watch:bot": "NODE_CONFIG_ENV=dev nodemon dist/src/index.js --dev",
|
"watch:bot": "NODE_CONFIG_ENV=dev nodemon dist/src/index.js",
|
||||||
"watch:rollup": "rollup -c --compact --watch",
|
"watch:rollup": "rollup -c --compact --watch",
|
||||||
"watch:tsc": "tsc --watch"
|
"watch:tsc": "tsc --watch"
|
||||||
},
|
},
|
||||||
|
|
|
@ -48,6 +48,8 @@ if (validate.valid) {
|
||||||
splitMultiline.forEach((val) => {
|
splitMultiline.forEach((val) => {
|
||||||
console.log(chalk`{grey (${date})} {magenta.bold ${ELoggingScope.Startup}} {red.bold.underline [FATAL]}: {red.underline ${val}}`);
|
console.log(chalk`{grey (${date})} {magenta.bold ${ELoggingScope.Startup}} {red.bold.underline [FATAL]}: {red.underline ${val}}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
figlet('Argon Bot', (err, data) => {
|
figlet('Argon Bot', (err, data) => {
|
||||||
|
|
|
@ -141,4 +141,6 @@ export function fatal(message: string, scope?: ELoggingScope): void {
|
||||||
else
|
else
|
||||||
console.log(chalk`{grey (${date})} {red.bold.underline [FATAL]}: {red.underline ${val}}`);
|
console.log(chalk`{grey (${date})} {red.bold.underline [FATAL]}: {red.underline ${val}}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue