From d8ceec1c072c460f3f0014c82381c8909cf5f50e Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Sat, 12 Jan 2019 13:30:02 -0500 Subject: [PATCH] Adjusting Sentry integration to include extra info --- src/components/App/index.js | 5 ++++- src/components/SentryBoundary/index.js | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/App/index.js b/src/components/App/index.js index a9794d5..b9f7845 100644 --- a/src/components/App/index.js +++ b/src/components/App/index.js @@ -37,7 +37,10 @@ class App extends React.PureComponent { }); } catch (e) { - Sentry.captureException(e, { syntax }); + Sentry.withScope(scope => { + scope.setExtra('syntax', syntax); + Sentry.captureException(e); + }); this.setState({ loading: false, loadingError: e diff --git a/src/components/SentryBoundary/index.js b/src/components/SentryBoundary/index.js index 124bf29..e814389 100644 --- a/src/components/SentryBoundary/index.js +++ b/src/components/SentryBoundary/index.js @@ -14,7 +14,11 @@ class SentryBoundary extends React.Component { } componentDidCatch(error, errorInfo) { - Sentry.captureException(error, errorInfo); + Sentry.withScope(scope => { + Object.keys(errorInfo).forEach(key => + scope.setExtra(key, errorInfo[key])); + Sentry.captureException(error); + }); } render() {