Skip to content

Commit 6fe27f7

Browse files
committed
Remove the error logging to GA, augment Sentry with the action prop
1 parent 54eea42 commit 6fe27f7

File tree

1 file changed

+11
-26
lines changed

1 file changed

+11
-26
lines changed

src/containers/error-boundary.jsx

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import {connect} from 'react-redux';
4-
import bowser from 'bowser';
54
import BrowserModalComponent from '../components/browser-modal/browser-modal.jsx';
65
import CrashMessageComponent from '../components/crash-message/crash-message.jsx';
76
import log from '../lib/log.js';
87
import supportedBrowser from '../lib/supported-browser';
9-
import analytics from '../lib/analytics';
108

119
class ErrorBoundary extends React.Component {
1210
constructor (props) {
@@ -24,36 +22,23 @@ class ErrorBoundary extends React.Component {
2422
message: 'Unknown error'
2523
};
2624

25+
// Log errors to analytics, leaving out supported browsers from unsupported.
26+
if (supportedBrowser() && window.Sentry) {
27+
window.Sentry.withScope(scope => {
28+
Object.keys(info).forEach(key => {
29+
scope.setExtra(key, info[key]);
30+
});
31+
scope.setExtra('action', this.props.action);
32+
window.Sentry.captureException(error);
33+
});
34+
}
35+
2736
// Display fallback UI
2837
this.setState({
2938
hasError: true,
3039
errorId: window.Sentry ? window.Sentry.lastEventId() : null
3140
});
3241

33-
// Log errors to analytics, separating supported browsers from unsupported.
34-
if (supportedBrowser()) {
35-
analytics.event({
36-
category: 'error',
37-
action: this.props.action,
38-
label: error.message
39-
});
40-
if (window.Sentry) {
41-
window.Sentry.withScope(scope => {
42-
Object.keys(info).forEach(key => {
43-
scope.setExtra(key, info[key]);
44-
});
45-
scope.setExtra('action', this.props.action);
46-
window.Sentry.captureException(error);
47-
});
48-
}
49-
} else {
50-
analytics.event({
51-
category: 'Unsupported Browser Error',
52-
action: `(Unsupported Browser) ${this.props.action}`,
53-
label: `${bowser.name} ${error.message}`
54-
});
55-
}
56-
5742
// Log error locally for debugging as well.
5843
log.error(`Unhandled Error: ${error.stack}\nComponent stack: ${info.componentStack}`);
5944
}

0 commit comments

Comments
 (0)