chore: improve error logging

This commit is contained in:
tdurieux
2022-08-10 08:16:26 +02:00
parent 3497d315fa
commit efcde0f822
2 changed files with 3 additions and 1 deletions

View File

@@ -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,

View File

@@ -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) {