chore: improve error logging

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

No files matched your search

+1 -1
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,
+2
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) {