import {Component} from 'react'; import * as Sentry from '@sentry/react'; import classNames from 'classnames'; import Button from 'sentry/components/button'; import {IconFlag} from 'sentry/icons'; import {t} from 'sentry/locale'; type DefaultProps = { /** * Hide support links in footer of error message */ hideSupportLinks: boolean; }; type Props = DefaultProps & { /** * Error heading */ heading: React.ReactNode; className?: string; /** * Detailed error explanation */ message?: React.ReactNode; /** * Retry callback */ onRetry?: (e: React.MouseEvent) => void; }; function openFeedback(e: React.MouseEvent) { e.preventDefault(); Sentry.showReportDialog(); } class DetailedError extends Component { static defaultProps: DefaultProps = { hideSupportLinks: false, }; componentDidMount() { // XXX(epurkhiser): Why is this here? this.forceUpdateTimeout = window.setTimeout(() => this.forceUpdate(), 100); } componentWillUnmount() { window.clearTimeout(this.forceUpdateTimeout); } forceUpdateTimeout: number | undefined = undefined; render() { const {className, heading, message, onRetry, hideSupportLinks} = this.props; const cx = classNames('detailed-error', className); const showFooter = !!onRetry || !hideSupportLinks; return (

{heading}

{message}
{showFooter && (
{onRetry && ( {t('Retry')} )}
{!hideSupportLinks && (
{Sentry.lastEventId() && ( )} {t('Service status')} {t('Contact support')}
)}
)}
); } } export default DetailedError;