From efcde0f822de5b23a37f50b4bdfa3496c7cb3d21 Mon Sep 17 00:00:00 2001 From: tdurieux Date: Wed, 10 Aug 2022 08:16:26 +0200 Subject: [PATCH] chore: improve error logging --- src/database/database.ts | 2 +- src/routes/route-utils.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/database/database.ts b/src/database/database.ts index 99eb02c..5e52d2f 100644 --- a/src/database/database.ts +++ b/src/database/database.ts @@ -17,7 +17,7 @@ export async function connect() { } export async function getRepository(repoId: string) { - if (!repoId) { + if (!repoId || repoId == 'undefined') { throw new AnonymousError("repo_not_found", { object: repoId, httpStatus: 404, diff --git a/src/routes/route-utils.ts b/src/routes/route-utils.ts index f3c4361..0bc7c72 100644 --- a/src/routes/route-utils.ts +++ b/src/routes/route-utils.ts @@ -49,6 +49,8 @@ function printError(error: any, req?: express.Request) { .trim()}`; if (req) { message += ` ${req.originalUrl}`; + // ignore common error + if (req.originalUrl === '/api/repo/undefined/options') return } console.error(message); } else if (error instanceof Error) {