Skip to content

Commit

Permalink
TW-1646 Add alerts and texts for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
keshan3262 committed Jan 17, 2025
1 parent a180afb commit 440de2d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/error-boundary/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Sentry from '@sentry/react-native';
import React, { Component, PropsWithChildren, ErrorInfo, FC } from 'react';
import { StyleProp, ViewStyle } from 'react-native';
import { Alert, StyleProp, ViewStyle } from 'react-native';

import { isString } from 'src/utils/is-string';

Expand Down Expand Up @@ -31,8 +31,10 @@ export class ErrorBoundary extends Component<Props, ErrorBoundaryState> {
}

componentDidCatch(error: Error, errorInfo: ErrorInfo) {
Sentry.captureException(error);
Alert.alert('TODO: Remove this alert', errorInfo.componentStack);
const sentryId = Sentry.captureException(error);
console.error(error.message, errorInfo.componentStack);
Alert.alert('TODO: Remove this alert 2', `Sentry ID: ${sentryId}`);
}

tryAgainIfNecessary = () => {
Expand All @@ -59,7 +61,9 @@ export class ErrorBoundary extends Component<Props, ErrorBoundaryState> {
const { style, children, Fallback } = this.props;
const { error } = this.state;

const errorMessage = error instanceof BoundaryError ? error.message : this.getDefaultErrorMessage();
const errorMessage =
error instanceof BoundaryError ? error.message : `${error?.message}\n${error?.name}\n${error?.stack}`;
// TODO: make this.getDefaultErrorMessage(); come back

if (error) {
return Fallback ? (
Expand Down

0 comments on commit 440de2d

Please sign in to comment.