mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-07-07 22:28:01 +02:00
chore: improves logging
This commit is contained in:
@@ -39,7 +39,7 @@ export async function getRepo(
|
|||||||
|
|
||||||
function printError(error: any) {
|
function printError(error: any) {
|
||||||
if (error instanceof AnonymousError) {
|
if (error instanceof AnonymousError) {
|
||||||
let detail = error.value?.toString();
|
let detail = error.value ? JSON.stringify(error.value) : null;
|
||||||
if (error.value instanceof Repository) {
|
if (error.value instanceof Repository) {
|
||||||
detail = error.value.repoId;
|
detail = error.value.repoId;
|
||||||
} else if (error.value instanceof AnonymizedFile) {
|
} else if (error.value instanceof AnonymizedFile) {
|
||||||
@@ -54,7 +54,7 @@ function printError(error: any) {
|
|||||||
console.error(
|
console.error(
|
||||||
"[ERROR]",
|
"[ERROR]",
|
||||||
error.message,
|
error.message,
|
||||||
`'${detail}'`,
|
detail ? `'${detail}'` : null,
|
||||||
error.stack.split("\n")[1].trim()
|
error.stack.split("\n")[1].trim()
|
||||||
);
|
);
|
||||||
} else if (error instanceof Error) {
|
} else if (error instanceof Error) {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export default class GitHubStream extends GitHubBase implements SourceBase {
|
|||||||
}
|
}
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
throw new AnonymousError("file_not_accessible");
|
throw new AnonymousError("file_not_accessible", file);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getFiles() {
|
async getFiles() {
|
||||||
|
|||||||
Reference in New Issue
Block a user