mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-02-27 17:33:21 +00:00
fix: improve error handling when a commit is not accessible
This commit is contained in:
@@ -72,12 +72,19 @@ export default class GitHubStream extends GitHubBase implements SourceBase {
|
||||
const octokit = new Octokit({
|
||||
auth: await this.getToken(),
|
||||
});
|
||||
const ghRes = await octokit.git.getTree({
|
||||
owner: this.githubRepository.owner,
|
||||
repo: this.githubRepository.repo,
|
||||
tree_sha: sha,
|
||||
recursive: "1",
|
||||
});
|
||||
|
||||
let ghRes;
|
||||
|
||||
try {
|
||||
ghRes = await octokit.git.getTree({
|
||||
owner: this.githubRepository.owner,
|
||||
repo: this.githubRepository.repo,
|
||||
tree_sha: sha,
|
||||
recursive: "1",
|
||||
});
|
||||
} catch (error) {
|
||||
throw new AnonymousError("repo_not_accessible", this.repository);
|
||||
}
|
||||
|
||||
const tree = this.tree2Tree(ghRes.data.tree, truncatedTree, parentPath);
|
||||
if (ghRes.data.truncated) {
|
||||
|
||||
Reference in New Issue
Block a user