From de666fdd1e2d4ce006fe0241be2d10647002b5db Mon Sep 17 00:00:00 2001 From: Matthieu Date: Tue, 28 Nov 2023 09:59:23 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A5=85=20(donate)=20notify=20errors=20to?= =?UTF-8?q?=20bugsnag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- site/stripe/DonateForm.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/site/stripe/DonateForm.tsx b/site/stripe/DonateForm.tsx index 593e9568761..6c2ba5a4bbd 100644 --- a/site/stripe/DonateForm.tsx +++ b/site/stripe/DonateForm.tsx @@ -15,6 +15,7 @@ import { Tippy, stringifyUnknownError, titleCase } from "@ourworldindata/utils" import { Checkbox } from "@ourworldindata/components" import { FontAwesomeIcon } from "@fortawesome/react-fontawesome/index.js" import { faArrowRight, faInfoCircle } from "@fortawesome/free-solid-svg-icons" +import Bugsnag from "@bugsnag/js" type Interval = "once" | "monthly" @@ -205,6 +206,19 @@ export class DonateForm extends React.Component { runInAction(() => { const prefixedErrorMessage = stringifyUnknownError(error) + // Send all errors to Bugsnag. This will help surface issues + // with our aging reCAPTCHA setup, and pull the trigger on a + // (hook-based?) rewrite if it starts failing. This reporting + // also includes form validation errors, which are useful to + // identify possible UX improvements or validate UX experiments + // (such as the combination of the name field and the "include + // my name on the list" checkbox). + Bugsnag.notify( + error instanceof Error + ? error + : new Error(prefixedErrorMessage) + ) + if (!prefixedErrorMessage) { this.errorMessage = "Something went wrong. Please get in touch with us at donate@ourworldindata.org"