Skip to content

Commit

Permalink
fix(scripts): remove failed attempts from scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
faris-imi committed Dec 4, 2023
1 parent 421b59e commit bd499f4
Showing 1 changed file with 8 additions and 1 deletion.
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

0 comments on commit bd499f4

Please sign in to comment.