mirror of
https://github.com/reiyua/github-profile-trophy-reiyua-mirror.git
synced 2026-11-17 06:02:09 +11:00
Add try catch for github api
This commit is contained in:
parent
f88e07535b
commit
135c24e31c
1 changed files with 21 additions and 16 deletions
|
|
@ -63,6 +63,7 @@ export class GithubApiService extends GithubRepository {
|
|||
this.requestUserIssue(username),
|
||||
this.requestUserPullRequest(username),
|
||||
]);
|
||||
try {
|
||||
const [repository, activity, issue, pullRequest] = await promises;
|
||||
const status = [
|
||||
repository.status,
|
||||
|
|
@ -82,6 +83,10 @@ export class GithubApiService extends GithubRepository {
|
|||
(pullRequest as PromiseFulfilledResult<GitHubUserPullRequest>).value,
|
||||
(repository as PromiseFulfilledResult<GitHubUserRepository>).value,
|
||||
);
|
||||
} catch {
|
||||
Logger.error(`Error fetching user info for username: ${username}`);
|
||||
return new ServiceError("Not found", EServiceKindError.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
async executeQuery<T = unknown>(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue