From 85ab24f369091d9b03a7e3b19aee95e433ae3ab5 Mon Sep 17 00:00:00 2001 From: tdurieux Date: Tue, 4 Oct 2022 11:11:02 +0200 Subject: [PATCH] fix: handle empty repo --- src/source/GitHubStream.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/source/GitHubStream.ts b/src/source/GitHubStream.ts index f1fb70a..d01cd08 100644 --- a/src/source/GitHubStream.ts +++ b/src/source/GitHubStream.ts @@ -93,9 +93,11 @@ export default class GitHubStream extends GitHubBase implements SourceBase { }); } catch (error) { if (error.status == 409) { - console.log(error.stack); // empty tree - ghRes = { data: { tree: [], truncated: false } }; + if (this.repository.status != "ready") + await this.repository.updateStatus("ready"); + // cannot be empty otherwise it would try to download it again + return { __: {} }; } else { await this.repository.resetSate("error", "repo_not_accessible"); throw new AnonymousError("repo_not_accessible", {