feat(settings): Add sentry capture for AppErrorDialog

Because:

* We want to measure how often users see this screen from an error on retrieving initial settings state, and compare with AppErrorBoundary

This commit:

* Add Sentry capture exception, add tags for source

Closes #
This commit is contained in:
Valerie Pomerleau 2024-11-15 12:43:48 -08:00
Родитель 387cf9e11c
Коммит 4a2d9b9518
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 33A451F0BB2180B4
2 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -4,7 +4,7 @@
import React from 'react';
import AppErrorDialog from '../AppErrorDialog';
import sentryMetrics from 'fxa-shared/sentry/browser';
import * as Sentry from '@sentry/browser';
interface AppErrorBoundaryProps {
children?: React.ReactNode;
@ -33,7 +33,7 @@ class AppErrorBoundary extends React.Component<
componentDidCatch(error: Error) {
console.error('AppError', error);
sentryMetrics.captureException(error);
Sentry.captureException(error, { tags: { source: 'AppErrorBoundary' } });
}
render() {

Просмотреть файл

@ -3,6 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import React, { useEffect } from 'react';
import * as Sentry from '@sentry/browser';
import SettingsLayout from './SettingsLayout';
import LoadingSpinner from 'fxa-react/components/LoadingSpinner';
import AppErrorDialog from 'fxa-react/components/AppErrorDialog';
@ -137,6 +138,7 @@ export const Settings = ({
// This error check includes a network error
if (error) {
Sentry.captureException(error, { tags: { source: 'settings' } });
GleanMetrics.error.view({ event: { reason: error.message } });
return <AppErrorDialog data-testid="error-dialog" {...{ error }} />;
}