From 99c66260a72d5c21f5784e42452a9cd5165313f9 Mon Sep 17 00:00:00 2001 From: Ryan Slobojan Date: Wed, 6 Oct 2021 13:10:36 -0400 Subject: [PATCH] Lots of Sentry error handling cleanup (don't log known situations) * Also fixed duplicated words on multi-dose selection * Bump rev to 1.9.18 --- components/Form.tsx | 17 +++++++++++------ components/Page.tsx | 2 +- public/locales/en/index.yml | 2 +- src/process.ts | 18 +++++++++++------- src/sentry.ts | 6 +++++- 5 files changed, 29 insertions(+), 16 deletions(-) diff --git a/components/Form.tsx b/components/Form.tsx index d28cd72..c8c64ef 100644 --- a/components/Form.tsx +++ b/components/Form.tsx @@ -135,7 +135,12 @@ function Form(): JSX.Element { if (e != undefined) { console.error(e); - Sentry.captureException(e); + // Don't report known errors to Sentry + if (!e.message.includes('invalidFileType') && + !e.message.includes('not digitally signed')) { + Sentry.captureException(e); + } + if (e.message != undefined) { setFileErrorMessage(e.message); @@ -286,12 +291,11 @@ function Form(): JSX.Element { } catch (e) { - if (e != undefined) { + if (e) { console.error(e); - Sentry.captureException(e); - if (e.message != undefined) { + if (e.message) { setAddErrorMessage(e.message); } else { setAddErrorMessage("Unable to continue."); @@ -299,10 +303,9 @@ function Form(): JSX.Element { } else { setAddErrorMessage("Unexpected error. Sorry."); - } - setSaveLoading(false); + setSaveLoading(false); } } @@ -348,7 +351,9 @@ function Form(): JSX.Element { setSaveLoading(false); } catch (e) { + Sentry.captureException(e); + setAddErrorMessage(e.message); setSaveLoading(false); } diff --git a/components/Page.tsx b/components/Page.tsx index 79fa7c1..0bfad0b 100644 --- a/components/Page.tsx +++ b/components/Page.tsx @@ -36,7 +36,7 @@ function Page(props: PageProps): JSX.Element { {t('common:gitHub')} {t('common:returnToMainSite')} -
Last updated: 2021-10-05 (v1.9.15)
+
Last updated: 2021-10-06 (v1.9.18)
diff --git a/public/locales/en/index.yml b/public/locales/en/index.yml index 398a6ea..593d4f8 100644 --- a/public/locales/en/index.yml +++ b/public/locales/en/index.yml @@ -15,7 +15,7 @@ ontarioHealth: Ontario Ministry of Health gotoOntarioHealth: Go to Ontario Ministry of Health downloadSignedPDF: and enter your information to display your official vaccination receipt. Press the Share Icon at the bottom, "Save As Files" to store it onto your iPhone. reminderNotToRepeat: If you have completed this step before, simply proceed to Step 2. -formatChange: After the recent vaccination receipt formatting change, both doses are included in the same file. Please select which dose you which dose you want to save. +formatChange: After the recent vaccination receipt formatting change, both doses are included in the same file. Please select which dose you want to save. saveMultiple: To save multiple receipts, please select the first one you want to save and click the Wallet or Photo button below, then change which dose is selected here and push the button again to generate another Wallet or Photo for another dose. pickColor: Pick a Color pickColorDescription: Pick a background color for your pass. diff --git a/src/process.ts b/src/process.ts index 13d9c36..59204d6 100644 --- a/src/process.ts +++ b/src/process.ts @@ -153,16 +153,18 @@ async function loadPDF(fileBuffer : ArrayBuffer): Promise> { console.error('invalid certificate'); return Promise.reject(`invalid certificate + ${JSON.stringify(result)}`); } - } catch (e) { - console.error(e); - - if (e.message.includes('Failed to locate ByteRange')) { + if (e.message.includes('Failed to locate ByteRange') || + e.message.includes('read ASN.1') || + e.message.includes('Failed byte range verification')) { e.message = 'Sorry. Selected PDF file is not digitally signed. Please download official copy from Step 1 and retry. Thanks.' } else { - Sentry.captureException(e); + if (!e.message.includes('cancelled')) { + console.error(e); + Sentry.captureException(e); + } } return Promise.reject(e); } @@ -184,7 +186,7 @@ async function getPdfDetails(fileBuffer: ArrayBuffer): Promise { SentryModule.init({ - release: 'grassroots_covidpass@1.9.15', // App version. Needs to be manually updated as we go unless we make the build smarter + release: 'grassroots_covidpass@1.9.18', // App version. Needs to be manually updated as we go unless we make the build smarter dsn: 'https://7120dcf8548c4c5cb148cdde2ed6a778@o1015766.ingest.sentry.io/5981424', integrations: [ new Integrations.BrowserTracing(), ], + ignoreErrors: [ + 'cancelled', + 'invalidFileType' + ], attachStacktrace: true, tracesSampleRate: 0.5