mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-07-04 20:57:56 +02:00
chore: improve error logging
This commit is contained in:
@@ -17,7 +17,7 @@ export async function connect() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getRepository(repoId: string) {
|
export async function getRepository(repoId: string) {
|
||||||
if (!repoId) {
|
if (!repoId || repoId == 'undefined') {
|
||||||
throw new AnonymousError("repo_not_found", {
|
throw new AnonymousError("repo_not_found", {
|
||||||
object: repoId,
|
object: repoId,
|
||||||
httpStatus: 404,
|
httpStatus: 404,
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ function printError(error: any, req?: express.Request) {
|
|||||||
.trim()}`;
|
.trim()}`;
|
||||||
if (req) {
|
if (req) {
|
||||||
message += ` ${req.originalUrl}`;
|
message += ` ${req.originalUrl}`;
|
||||||
|
// ignore common error
|
||||||
|
if (req.originalUrl === '/api/repo/undefined/options') return
|
||||||
}
|
}
|
||||||
console.error(message);
|
console.error(message);
|
||||||
} else if (error instanceof Error) {
|
} else if (error instanceof Error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user