Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7bf4a87

Browse files
authored
refactor: add GitHub REST API error to CustomError class (anuraghazra#3272)
1 parent65c3300 commit7bf4a87

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

‎src/common/utils.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,13 +399,16 @@ const CONSTANTS = {
399399
ERROR_CACHE_SECONDS:TEN_MINUTES,
400400
};
401401

402+
constTRY_AGAING_LATER="Please try again later";
403+
402404
constSECONDARY_ERROR_MESSAGES={
403405
MAX_RETRY:
404406
"You can deploy own instance or wait until public will be no longer limited",
405407
NO_TOKENS:
406408
"Please add an env variable called PAT_1 with your GitHub API token in vercel",
407409
USER_NOT_FOUND:"Make sure the provided username is not an organization",
408-
GRAPHQL_ERROR:"Please try again later",
410+
GRAPHQL_ERROR:TRY_AGAING_LATER,
411+
GITHUB_REST_API_ERROR:TRY_AGAING_LATER,
409412
WAKATIME_USER_NOT_FOUND:"Make sure you have a public WakaTime profile",
410413
};
411414

@@ -427,6 +430,7 @@ class CustomError extends Error {
427430
staticNO_TOKENS="NO_TOKENS";
428431
staticUSER_NOT_FOUND="USER_NOT_FOUND";
429432
staticGRAPHQL_ERROR="GRAPHQL_ERROR";
433+
staticGITHUB_REST_API_ERROR="GITHUB_REST_API_ERROR";
430434
staticWAKATIME_ERROR="WAKATIME_ERROR";
431435
}
432436

‎src/fetchers/stats-fetcher.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ const totalCommitsFetcher = async (username) => {
182182
if(!totalCount||isNaN(totalCount)){
183183
thrownewCustomError(
184184
"Could not fetch total commits.",
185-
CustomError.GRAPHQL_ERROR,
185+
CustomError.GITHUB_REST_API_ERROR,
186186
);
187187
}
188188
returntotalCount;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp