mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-07-10 07:28:36 +02:00
fix: improve error handling when a commit is not accessible
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"ERRORS": {
|
"ERRORS": {
|
||||||
"repo_not_found": "The repository is not found.",
|
"repo_not_found": "The repository is not found.",
|
||||||
"repo_not_accessible": "Anonymous GitHub does not have the permission to access the repository.",
|
"repo_not_accessible": "Anonymous GitHub is unable to or is forbidden to access the repository.",
|
||||||
"repository_expired": "The repository is expired",
|
"repository_expired": "The repository is expired",
|
||||||
"repository_not_ready": "Anonymous GitHub is still processing the repository, it can take several minutes.",
|
"repository_not_ready": "Anonymous GitHub is still processing the repository, it can take several minutes.",
|
||||||
"repo_is_updating": "Anonymous GitHub is still processing the repository, it can take several minutes.",
|
"repo_is_updating": "Anonymous GitHub is still processing the repository, it can take several minutes.",
|
||||||
|
|||||||
@@ -1190,8 +1190,9 @@ angular
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
console.log(err);
|
$scope.type = "error";
|
||||||
$scope.files = [];
|
$scope.content = err.data.error;
|
||||||
|
$scope.files = null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,12 +72,19 @@ export default class GitHubStream extends GitHubBase implements SourceBase {
|
|||||||
const octokit = new Octokit({
|
const octokit = new Octokit({
|
||||||
auth: await this.getToken(),
|
auth: await this.getToken(),
|
||||||
});
|
});
|
||||||
const ghRes = await octokit.git.getTree({
|
|
||||||
owner: this.githubRepository.owner,
|
let ghRes;
|
||||||
repo: this.githubRepository.repo,
|
|
||||||
tree_sha: sha,
|
try {
|
||||||
recursive: "1",
|
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);
|
const tree = this.tree2Tree(ghRes.data.tree, truncatedTree, parentPath);
|
||||||
if (ghRes.data.truncated) {
|
if (ghRes.data.truncated) {
|
||||||
|
|||||||
Reference in New Issue
Block a user