add support in ErrorBoundary for setting errorboundary tag

This commit is contained in:
Ben Wheeler 2019-10-09 22:30:35 -04:00
parent 46ef423c5d
commit 0f8eb638cc

View file

@ -17,6 +17,9 @@ class ErrorBoundary extends React.Component {
componentDidCatch (error, errorInfo) {
// Display fallback UI
Sentry.withScope(scope => {
if (this.props.name) {
scope.setTag('errorboundary', this.props.name);
}
Object.keys(errorInfo).forEach(key => {
scope.setExtra(key, errorInfo[key]);
});
@ -46,7 +49,8 @@ class ErrorBoundary extends React.Component {
}
}
ErrorBoundary.propTypes = {
children: PropTypes.node
children: PropTypes.node,
name: PropTypes.string
};
module.exports = ErrorBoundary;