Skip to content

Commit

Permalink
fix(scripts): remove failed attempts from scripts (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
faris-imi authored Dec 4, 2023
1 parent 421b59e commit 2c1e320
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion lib/src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,27 @@ export function hCaptchaApi(params: ILoaderParams = { cleanup: true }, sentry: S
data: script
});

hCaptchaScripts.push({ promise, scope: frame.window });
} catch(error) {
sentry.addBreadcrumb({
category: SENTRY_TAG,
message: 'hCaptcha failed to load',
data: error,
});


const scriptIndex = hCaptchaScripts.findIndex(script => script.scope === frame.window);

if (scriptIndex !== -1) {
hCaptchaScripts.splice(scriptIndex, 1);
}

sentry.captureException(error);
reject(new Error(SCRIPT_ERROR));
}
}
);

hCaptchaScripts.push({ promise, scope: frame.window });
return promise;
} catch (error) {
sentry.captureException(error);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@hcaptcha/loader",
"description": "This is a JavaScript library to easily configure the loading of the hCaptcha JS client SDK with built-in error handling.",
"version": "1.1.1",
"version": "1.1.2",
"author": "hCaptcha team and contributors",
"license": "MIT",
"keywords": [
Expand Down

0 comments on commit 2c1e320

Please sign in to comment.