Skip to content

Commit 77fb9b6

Browse files
authored
Merge pull request #4165 from paulkaplan/use-new-sentry-api
Use new sentry API provided by www, and use analytics ID from www
2 parents 19f5b19 + 50a9172 commit 77fb9b6

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/containers/error-boundary.jsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ErrorBoundary extends React.Component {
2727
// Display fallback UI
2828
this.setState({
2929
hasError: true,
30-
errorId: window.Raven ? window.Raven.lastEventId() : null
30+
errorId: window.Sentry ? window.Sentry.lastEventId() : null
3131
});
3232

3333
// Log errors to analytics, separating supported browsers from unsupported.
@@ -37,8 +37,13 @@ class ErrorBoundary extends React.Component {
3737
action: this.props.action,
3838
label: error.message
3939
});
40-
if (window.Raven) {
41-
window.Raven.captureException(error, {extra: info});
40+
if (window.Sentry) {
41+
window.Sentry.withScope(scope => {
42+
Object.keys(info).forEach(key => {
43+
scope.setExtra(key, info[key]);
44+
});
45+
window.Sentry.captureException(error);
46+
});
4247
}
4348
} else {
4449
analytics.event({

src/lib/analytics.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import GoogleAnalytics from 'react-ga';
22

3-
GoogleAnalytics.initialize(process.env.GA_ID, {
3+
GoogleAnalytics.initialize(process.env.GA_ID || window.GA_ID, {
44
debug: (process.env.NODE_ENV !== 'production'),
55
titleCase: true,
66
sampleRate: (process.env.NODE_ENV === 'production') ? 100 : 0,

0 commit comments

Comments
 (0)