Handle missed error branch (#8663)

This commit is contained in:
Eric Bailey
2025-07-18 10:19:56 -05:00
committed by GitHub
parent 4dd9459cba
commit 6a15679fb1
@@ -134,16 +134,18 @@ function Inner() {
setSuccess(true) setSuccess(true)
} catch (e) { } catch (e) {
let error: React.ReactNode = _(
msg`Something went wrong, please try again`,
)
if (e instanceof XRPCError) { if (e instanceof XRPCError) {
if (e.error === 'InvalidEmail') { if (e.error === 'InvalidEmail') {
setError( error = _(
_( msg`Please enter a valid, non-temporary email address. You may need to access this email in the future.`,
msg`Please enter a valid, non-temporary email address. You may need to access this email in the future.`,
),
) )
logger.metric('ageAssurance:initDialogError', {code: 'InvalidEmail'}) logger.metric('ageAssurance:initDialogError', {code: 'InvalidEmail'})
} else if (e.error === 'DidTooLong') { } else if (e.error === 'DidTooLong') {
setError( error = (
<> <>
<Trans> <Trans>
We're having issues initializing the age assurance process for We're having issues initializing the age assurance process for
@@ -155,15 +157,19 @@ function Inner() {
</InlineLinkText>{' '} </InlineLinkText>{' '}
for assistance. for assistance.
</Trans> </Trans>
</>, </>
) )
logger.metric('ageAssurance:initDialogError', {code: 'DidTooLong'}) logger.metric('ageAssurance:initDialogError', {code: 'DidTooLong'})
} else {
logger.metric('ageAssurance:initDialogError', {code: 'other'})
} }
} else { } else {
const {clean, raw} = cleanError(e) const {clean, raw} = cleanError(e)
setError(clean || raw || _(msg`Something went wrong, please try again`)) error = clean || raw || error
logger.metric('ageAssurance:initDialogError', {code: 'other'}) logger.metric('ageAssurance:initDialogError', {code: 'other'})
} }
setError(error)
} }
} }