mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 07:38:07 -05:00
add support in ErrorBoundary for setting errorboundary tag
This commit is contained in:
parent
46ef423c5d
commit
0f8eb638cc
1 changed files with 5 additions and 1 deletions
|
@ -17,6 +17,9 @@ class ErrorBoundary extends React.Component {
|
||||||
componentDidCatch (error, errorInfo) {
|
componentDidCatch (error, errorInfo) {
|
||||||
// Display fallback UI
|
// Display fallback UI
|
||||||
Sentry.withScope(scope => {
|
Sentry.withScope(scope => {
|
||||||
|
if (this.props.name) {
|
||||||
|
scope.setTag('errorboundary', this.props.name);
|
||||||
|
}
|
||||||
Object.keys(errorInfo).forEach(key => {
|
Object.keys(errorInfo).forEach(key => {
|
||||||
scope.setExtra(key, errorInfo[key]);
|
scope.setExtra(key, errorInfo[key]);
|
||||||
});
|
});
|
||||||
|
@ -46,7 +49,8 @@ class ErrorBoundary extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ErrorBoundary.propTypes = {
|
ErrorBoundary.propTypes = {
|
||||||
children: PropTypes.node
|
children: PropTypes.node,
|
||||||
|
name: PropTypes.string
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = ErrorBoundary;
|
module.exports = ErrorBoundary;
|
||||||
|
|
Loading…
Reference in a new issue