Use pino error instead of fatal

Fatal throws flushing error when using 'pretty' log style
This commit is contained in:
rijkvanzanten
2021-02-23 11:29:37 -05:00
parent 12690707ee
commit 142b250c8d
4 changed files with 5 additions and 5 deletions

View File

@@ -55,7 +55,7 @@ export default async function createApp() {
await validateDBConnection();
if ((await isInstalled()) === false) {
logger.fatal(`Database doesn't have Directus tables installed.`);
logger.error(`Database doesn't have Directus tables installed.`);
process.exit(1);
}

View File

@@ -65,8 +65,8 @@ export async function validateDBConnection() {
try {
await hasDatabaseConnection();
} catch (error) {
logger.fatal(`Can't connect to the database.`);
logger.fatal(error);
logger.error(`Can't connect to the database.`);
logger.error(error);
process.exit(1);
}
}

View File

@@ -23,7 +23,7 @@ export default async function start() {
})
.once('error', (err: any) => {
if (err?.code === 'EADDRINUSE') {
logger.fatal(`Port ${port} is already in use`);
logger.error(`Port ${port} is already in use`);
process.exit(1);
} else {
throw err;

View File

@@ -16,7 +16,7 @@ export function validateEnv(requiredKeys: string[]) {
for (const requiredKey of requiredKeys) {
if (env.hasOwnProperty(requiredKey) === false) {
logger.fatal(`Environment is missing the ${requiredKey} key.`);
logger.error(`"${requiredKey}" Environment Variable is missing.`);
process.exit(1);
}
}