Converting SentryError to a functional component
This commit is contained in:
parent
ea8e4fba08
commit
befcac2087
@ -5,26 +5,22 @@ import { withNamespaces, Trans } from 'react-i18next';
|
|||||||
|
|
||||||
import Message from 'components/Message';
|
import Message from 'components/Message';
|
||||||
|
|
||||||
export class SentryError extends React.Component {
|
const reportError = event => {
|
||||||
reportError = event => {
|
event.preventDefault();
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
if (Sentry.lastEventId()) {
|
if (Sentry.lastEventId()) {
|
||||||
Sentry.showReportDialog();
|
Sentry.showReportDialog();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
export const SentryError = ({ t }) => (
|
||||||
const { t } = this.props;
|
<Message type="error" heading={ t('An error has occurred') }>
|
||||||
|
<p>
|
||||||
return <Message type="error" heading={ t('An error has occurred') }>
|
<Trans>This error has been logged. You may also <a href="#error-report"
|
||||||
<p>
|
onClick={ reportError }>fill out a report</a>.</Trans>
|
||||||
<Trans>This error has been logged. You may also <a href="#error-report"
|
</p>
|
||||||
onClick={ this.reportError }>fill out a report</a>.</Trans>
|
</Message>
|
||||||
</p>
|
);
|
||||||
</Message>;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SentryError.propTypes = {
|
SentryError.propTypes = {
|
||||||
t: PropTypes.func.isRequired
|
t: PropTypes.func.isRequired
|
||||||
|
Loading…
Reference in New Issue
Block a user