chore: improves logging

This commit is contained in:
tdurieux
2021-09-07 08:41:35 +02:00
parent 0f8572fe01
commit 81a091e9e1
2 changed files with 3 additions and 3 deletions

View File

@@ -39,7 +39,7 @@ export async function getRepo(
function printError(error: any) {
if (error instanceof AnonymousError) {
let detail = error.value?.toString();
let detail = error.value ? JSON.stringify(error.value) : null;
if (error.value instanceof Repository) {
detail = error.value.repoId;
} else if (error.value instanceof AnonymizedFile) {
@@ -54,7 +54,7 @@ function printError(error: any) {
console.error(
"[ERROR]",
error.message,
`'${detail}'`,
detail ? `'${detail}'` : null,
error.stack.split("\n")[1].trim()
);
} else if (error instanceof Error) {

View File

@@ -59,7 +59,7 @@ export default class GitHubStream extends GitHubBase implements SourceBase {
}
console.error(error);
}
throw new AnonymousError("file_not_accessible");
throw new AnonymousError("file_not_accessible", file);
}
async getFiles() {