Skip to content

Commit

Permalink
fix(retry): change naming
Browse files Browse the repository at this point in the history
  • Loading branch information
faris-imi committed Dec 4, 2023
1 parent 648e21e commit 6f34480
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export const SCRIPT_COMPLETE = 'script-loaded';

export const SENTRY_TAG = '@hCaptcha/loader';

export const RETRY_COUNT = 2;
export const MAX_RETRIES = 2;
6 changes: 3 additions & 3 deletions lib/src/loader.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { generateQuery, getFrame, getMountElement } from './utils';
import { HCAPTCHA_LOAD_FN_NAME, RETRY_COUNT, SCRIPT_ERROR, SENTRY_TAG } from './constants';
import { HCAPTCHA_LOAD_FN_NAME, MAX_RETRIES, SCRIPT_ERROR, SENTRY_TAG } from './constants';
import { initSentry } from './sentry';
import { fetchScript } from './script';

Expand Down Expand Up @@ -92,7 +92,7 @@ export function hCaptchaApi(params: ILoaderParams = { cleanup: true }, sentry: S
}

export async function loadScript(params, retries = 0) {
const message = retries < RETRY_COUNT ? 'Retry loading hCaptcha Api' : 'Exceeded maximum retries';
const message = retries < MAX_RETRIES ? 'Retry loading hCaptcha Api' : 'Exceeded maximum retries';

const sentry = initSentry(params.sentry);

Expand All @@ -107,7 +107,7 @@ export async function loadScript(params, retries = 0) {
data: { error }
});

if (retries >= RETRY_COUNT) {
if (retries >= MAX_RETRIES) {
sentry.captureException(error);
return Promise.reject(error);
} else {
Expand Down

0 comments on commit 6f34480

Please sign in to comment.