Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentDidCatch (error, errorInfo) {
// Display fallback UI
Sentry.withScope(scope => {
Object.keys(errorInfo).forEach(key => {
scope.setExtra(key, errorInfo[key]);
});
Sentry.captureException(error);
});
this.setState({
hasError: true,
errorId: Sentry.lastEventId()
});
log.error(`Unhandled Error: ${error}, info: ${errorInfo}`);
}
<div>{message}</div>
{showFooter && (
<div>
<div>
{onRetry && (
<a>
{t('Retry')}
</a>
)}
</div>
{!hideSupportLinks && (
<div>
{Sentry.lastEventId() && (
<button>
{t('Fill out a report')}
</button>
)}
<a href="https://status.sentry.io/">{t('Service status')}</a>
<a href="https://sentry.io/support/">{t('Contact support')}</a>
</div>
)}
</div>
)}
);
}
}