diff options
author | Hailey <me@haileyok.com> | 2024-05-01 01:08:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-01 01:08:59 -0700 |
commit | b8d8bec388744c95aa84c955849d2bced45daf11 (patch) | |
tree | 987435632fae8bbfea56c935e6d55021356b636a /src/screens/Signup/StepCaptcha/CaptchaWebView.web.tsx | |
parent | 81ae7e425dc52846c5d4c282a0422a3875d84e2f (diff) | |
download | voidsky-b8d8bec388744c95aa84c955849d2bced45daf11.tar.zst |
sentry errors for captcha web views and registration attempts (#3761)
* sentry errors for captcha web views * include handles with errors * log all registration request failures * rm * use a better trigger for web captcha errors * add another trigger for recording a possible signup error * unknown error type * don't needlessly log on href errors * honestly i probably cant always do a captcha in 20 seconds * rm log * timeout on back * remove unnecessary colons
Diffstat (limited to 'src/screens/Signup/StepCaptcha/CaptchaWebView.web.tsx')
-rw-r--r-- | src/screens/Signup/StepCaptcha/CaptchaWebView.web.tsx | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/screens/Signup/StepCaptcha/CaptchaWebView.web.tsx b/src/screens/Signup/StepCaptcha/CaptchaWebView.web.tsx index 7791a58dd..8faaf90a0 100644 --- a/src/screens/Signup/StepCaptcha/CaptchaWebView.web.tsx +++ b/src/screens/Signup/StepCaptcha/CaptchaWebView.web.tsx @@ -13,8 +13,20 @@ export function CaptchaWebView({ url: string stateParam: string onSuccess: (code: string) => void - onError: () => void + onError: (error: unknown) => void }) { + React.useEffect(() => { + const timeout = setTimeout(() => { + onError({ + errorMessage: 'User did not complete the captcha within 30 seconds', + }) + }, 30e3) + + return () => { + clearTimeout(timeout) + } + }, [onError]) + const onLoad = React.useCallback(() => { // @ts-ignore web const frame: HTMLIFrameElement = document.getElementById( @@ -32,12 +44,14 @@ export function CaptchaWebView({ const code = urlp.searchParams.get('code') if (urlp.searchParams.get('state') !== stateParam || !code) { - onError() + onError({error: 'Invalid state or code'}) return } onSuccess(code) - } catch (e) { - // We don't need to handle this + } catch (e: unknown) { + // We don't actually want to record an error here, because this will happen quite a bit. We will only be able to + // get hte href of the iframe if it's on our domain, so all the hcaptcha requests will throw here, although it's + // harmless. Our other indicators of time-to-complete and back press should be more reliable in catching issues. } }, [stateParam, onSuccess, onError]) |