mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-09-23 02:40:42 +02:00
fix: fix error message when repository is not found
This commit is contained in:
@@ -55,6 +55,7 @@ export class GitHubRepository {
|
|||||||
) {
|
) {
|
||||||
// get the list of repo from github
|
// get the list of repo from github
|
||||||
const octokit = new Octokit({ auth: opt.accessToken });
|
const octokit = new Octokit({ auth: opt.accessToken });
|
||||||
|
try {
|
||||||
const branches = (
|
const branches = (
|
||||||
await octokit.paginate(octokit.repos.listBranches, {
|
await octokit.paginate(octokit.repos.listBranches, {
|
||||||
owner: this.owner,
|
owner: this.owner,
|
||||||
@@ -71,13 +72,19 @@ export class GitHubRepository {
|
|||||||
} as Branch;
|
} as Branch;
|
||||||
});
|
});
|
||||||
this._data.branches = branches;
|
this._data.branches = branches;
|
||||||
|
|
||||||
if (isConnected) {
|
if (isConnected) {
|
||||||
await RepositoryModel.updateOne(
|
await RepositoryModel.updateOne(
|
||||||
{ externalId: this.id },
|
{ externalId: this.id },
|
||||||
{ $set: { branches } }
|
{ $set: { branches } }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
throw new AnonymousError("repo_not_found", {
|
||||||
|
httpStatus: (error as any).status,
|
||||||
|
cause: error as Error,
|
||||||
|
object: this,
|
||||||
|
});
|
||||||
|
}
|
||||||
} else if (isConnected) {
|
} else if (isConnected) {
|
||||||
const q = await RepositoryModel.findOne({ externalId: this.id }).select(
|
const q = await RepositoryModel.findOne({ externalId: this.id }).select(
|
||||||
"branches"
|
"branches"
|
||||||
|
|||||||
Reference in New Issue
Block a user