From 9e0088e15553ce658092c56cd2d12b938b8e4820 Mon Sep 17 00:00:00 2001 From: Josh Moore Date: Thu, 13 Jul 2023 01:51:02 -0600 Subject: [PATCH] feat: improved some error logs --- backend/UserConfig.ts | 2 +- backend/app.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/UserConfig.ts b/backend/UserConfig.ts index a138c49..e7f6f99 100644 --- a/backend/UserConfig.ts +++ b/backend/UserConfig.ts @@ -50,7 +50,7 @@ export class UserConfig { const config = (typeof c === 'string' ? JSON.parse(c) : c) as UserConfiguration; if (!Checkers.uploadsDir(config.uploadsDir)) throw new Error(`Unable to access uploads directory: ${config.uploadsDir}`); - if (!Checkers.idType(config.idType)) throw new Error('Invalid ID type'); + if (!Checkers.idType(config.idType)) throw new Error(`Invalid ID type: ${config.idType}`); if (!Checkers.idSize(config.idSize)) throw new Error('Invalid ID size'); if (!Checkers.gfySize(config.gfySize)) throw new Error('Invalid Gfy size'); if (!Checkers.maximumFileSize(config.maximumFileSize)) throw new Error('Invalid maximum file size'); diff --git a/backend/app.ts b/backend/app.ts index a78f9d7..35754f1 100644 --- a/backend/app.ts +++ b/backend/app.ts @@ -53,7 +53,7 @@ async function main() { // Attempt to load user configuration const readUserConfig = (): Promise => new Promise((resolve) => - UserConfig.readConfigFile().then(() => resolve(void 0)).catch((err) => (console.error(err), resolve(void 0)))); + UserConfig.readConfigFile().then(() => resolve(void 0)).catch((err) => (err.code && err.code === 'ENOENT' ? {} : console.error(err), resolve(void 0)))); await readUserConfig(); // Set up Express