Skip to content

Commit a912ea2

Browse files
committed
chore: Remove references to window.Sentry
1 parent 6fa7606 commit a912ea2

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

app/components/ErrorBoundary.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// @flow
2+
import * as Sentry from "@sentry/react";
23
import { observable } from "mobx";
34
import { observer } from "mobx-react";
45
import * as React from "react";
@@ -36,8 +37,8 @@ class ErrorBoundary extends React.Component<Props> {
3637
return;
3738
}
3839

39-
if (window.Sentry) {
40-
window.Sentry.captureException(error);
40+
if (env.SENTRY_DSN) {
41+
Sentry.captureException(error);
4142
}
4243
}
4344

@@ -56,7 +57,7 @@ class ErrorBoundary extends React.Component<Props> {
5657
render() {
5758
if (this.error) {
5859
const error = this.error;
59-
const isReported = !!window.Sentry && env.DEPLOYMENT === "hosted";
60+
const isReported = !!env.SENTRY_DSN && env.DEPLOYMENT === "hosted";
6061
const isChunkError = this.error.message.match(/chunk/);
6162

6263
if (isChunkError) {

app/stores/AuthStore.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
// @flow
2+
import * as Sentry from "@sentry/react";
23
import invariant from "invariant";
34
import { observable, action, computed, autorun, runInAction } from "mobx";
45
import { getCookie, setCookie, removeCookie } from "tiny-cookie";
56
import RootStore from "stores/RootStore";
67
import Team from "models/Team";
78
import User from "models/User";
9+
import env from "env";
810
import { client } from "utils/ApiClient";
911
import { getCookieDomain } from "utils/domains";
1012

@@ -125,8 +127,8 @@ export default class AuthStore {
125127
this.user = new User(user);
126128
this.team = new Team(team);
127129

128-
if (window.Sentry) {
129-
window.Sentry.configureScope(function (scope) {
130+
if (env.SENTRY_DSN) {
131+
Sentry.configureScope(function (scope) {
130132
scope.setUser({ id: user.id });
131133
scope.setExtra("team", team.name);
132134
scope.setExtra("teamId", team.id);

0 commit comments

Comments
 (0)