diff --git a/package.json b/package.json index ba651a5340..702bac04b6 100644 --- a/package.json +++ b/package.json @@ -183,8 +183,8 @@ "@hapi/call": "^8.0.1", "@hapi/subtext": "^7.0.3", "@kubernetes/client-node": "^0.15.1", - "@sentry/electron": "^2.5.0", - "@sentry/integrations": "^6.10.0", + "@sentry/electron": "^2.5.4", + "@sentry/integrations": "^6.13.3", "abort-controller": "^3.0.0", "array-move": "^3.0.1", "auto-bind": "^4.0.0", @@ -257,8 +257,7 @@ "@material-ui/icons": "^4.11.2", "@material-ui/lab": "^4.0.0-alpha.60", "@pmmmwh/react-refresh-webpack-plugin": "^0.4.3", - "@sentry/react": "^6.13.3", - "@sentry/types": "^6.8.0", + "@sentry/types": "^6.13.3", "@testing-library/dom": "^8.9.0", "@testing-library/jest-dom": "^5.14.1", "@testing-library/react": "^11.2.6", diff --git a/src/renderer/bootstrap.tsx b/src/renderer/bootstrap.tsx index d80512561a..1a29faa0ae 100644 --- a/src/renderer/bootstrap.tsx +++ b/src/renderer/bootstrap.tsx @@ -51,6 +51,10 @@ import { TerminalStore } from "./components/dock/terminal.store"; import cloudsMidnight from "./monaco-themes/Clouds Midnight.json"; import { AppPaths } from "../common/app-paths"; +if (process.isMainFrame) { + SentryInit(); +} + configurePackages(); /** @@ -72,6 +76,8 @@ export async function bootstrap(comp: () => Promise) { await AppPaths.init(); const rootElem = document.getElementById("app"); + UserStore.createInstance(); + await attachChromeDebugger(); rootElem.classList.toggle("is-mac", isMac); @@ -90,10 +96,6 @@ export async function bootstrap(comp: () => Promise) { ExtensionLoader.createInstance().init(); ExtensionDiscovery.createInstance().init(); - UserStore.createInstance(); - - SentryInit(); - // ClusterStore depends on: UserStore const cs = ClusterStore.createInstance(); diff --git a/src/renderer/components/error-boundary/error-boundary.tsx b/src/renderer/components/error-boundary/error-boundary.tsx index dd345e9f48..6268bd40b1 100644 --- a/src/renderer/components/error-boundary/error-boundary.tsx +++ b/src/renderer/components/error-boundary/error-boundary.tsx @@ -21,54 +21,68 @@ import "./error-boundary.scss"; -import React from "react"; +import React, { ErrorInfo } from "react"; +import { observer } from "mobx-react"; import { Button } from "../button"; import { navigation } from "../../navigation"; import { issuesTrackerUrl, slackUrl } from "../../../common/vars"; -import * as Sentry from "@sentry/react"; -import { observer } from "mobx-react"; + +interface Props { +} + +interface State { + error?: Error; + errorInfo?: ErrorInfo; +} @observer -export class ErrorBoundary extends React.Component { - render() { - return ( - { - const slackLink = Slack; - const githubLink = GitHub; - const pageUrl = location.pathname; +export class ErrorBoundary extends React.Component { + public state: State = {}; - return ( -
-
- App crash at {pageUrl} -
-

- To help us improve the product please report bugs to {slackLink} community or {githubLink} issues tracker. -

-
- -

Component stack:

- {componentStack} -
- -

Error stack:


- {error.stack} -
-
-
- ); - }}> - {this.props.children} -
- ); + componentDidCatch(error: Error, errorInfo: ErrorInfo) { + this.setState({ error, errorInfo }); + } + + back = () => { + this.setState({ error: null, errorInfo: null }); + navigation.goBack(); + }; + + render() { + const { error, errorInfo } = this.state; + + if (error) { + const slackLink = Slack; + const githubLink = Github; + const pageUrl = location.pathname; + + return ( +
+
+ App crash at {pageUrl} +
+

+ To help us improve the product please report bugs to {slackLink} community or {githubLink} issues tracker. +

+
+ +

Component stack:

+ {errorInfo.componentStack} +
+ +

Error stack:

+ {error.stack} +
+
+
+ ); + } + + return this.props.children; } } diff --git a/yarn.lock b/yarn.lock index 7b9b1ec39b..7730ec8805 100644 --- a/yarn.lock +++ b/yarn.lock @@ -963,16 +963,6 @@ schema-utils "^2.6.5" source-map "^0.7.3" -"@sentry/browser@6.13.3": - version "6.13.3" - resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.13.3.tgz#d4511791b1e484ad48785eba3bce291fdf115c1e" - integrity sha512-jwlpsk2/u1cofvfYsjmqcnx50JJtf/T6HTgdW+ih8+rqWC5ABEZf4IiB/H+KAyjJ3wVzCOugMq5irL83XDCfqQ== - dependencies: - "@sentry/core" "6.13.3" - "@sentry/types" "6.13.3" - "@sentry/utils" "6.13.3" - tslib "^1.9.3" - "@sentry/browser@6.7.1": version "6.7.1" resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.7.1.tgz#e01144a08984a486ecc91d7922cc457e9c9bd6b7" @@ -983,17 +973,6 @@ "@sentry/utils" "6.7.1" tslib "^1.9.3" -"@sentry/core@6.13.3": - version "6.13.3" - resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.13.3.tgz#5cbbb995128e793ebebcbf1d3b7514e0e5e8b221" - integrity sha512-obm3SjgCk8A7nB37b2AU1eq1q7gMoJRrGMv9VRIyfcG0Wlz/5lJ9O3ohUk+YZaaVfZMxXn6hFtsBiOWmlv7IIA== - dependencies: - "@sentry/hub" "6.13.3" - "@sentry/minimal" "6.13.3" - "@sentry/types" "6.13.3" - "@sentry/utils" "6.13.3" - tslib "^1.9.3" - "@sentry/core@6.7.1": version "6.7.1" resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.7.1.tgz#c3aaa6415d06bec65ac446b13b84f073805633e3" @@ -1005,10 +984,10 @@ "@sentry/utils" "6.7.1" tslib "^1.9.3" -"@sentry/electron@^2.5.0": - version "2.5.0" - resolved "https://registry.yarnpkg.com/@sentry/electron/-/electron-2.5.0.tgz#4168ff04ee01cb5a99ce042f3435660a510c634d" - integrity sha512-OiJWi9BKtlj4UeoaCArVXIvfW808fgW1GLmeiC7wD7B64ALHSYSwu8tkqZK+IMVhPmQN04AUyoYXrZohfJ7sOg== +"@sentry/electron@^2.5.4": + version "2.5.4" + resolved "https://registry.yarnpkg.com/@sentry/electron/-/electron-2.5.4.tgz#337b2f7e228e805a3e4eb3611c7b12c6cf87c618" + integrity sha512-tCCK+P581TmdjsDpHBQz7qYcldzGdUk1Fd6FPxPy1JKGzeY4uf/uSLKzR80Lzs5kTpEZFOwiMHSA8yjwFp5qoA== dependencies: "@sentry/browser" "6.7.1" "@sentry/core" "6.7.1" @@ -1018,15 +997,6 @@ "@sentry/utils" "6.7.1" tslib "^2.2.0" -"@sentry/hub@6.13.3": - version "6.13.3" - resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.13.3.tgz#cc09623a69b5343315fdb61c7fdd0be74b72299f" - integrity sha512-eYppBVqvhs5cvm33snW2sxfcw6G20/74RbBn+E4WDo15hozis89kU7ZCJDOPkXuag3v1h9igns/kM6PNBb41dw== - dependencies: - "@sentry/types" "6.13.3" - "@sentry/utils" "6.13.3" - tslib "^1.9.3" - "@sentry/hub@6.7.1": version "6.7.1" resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.7.1.tgz#d46d24deec67f0731a808ca16796e6765b371bc1" @@ -1036,23 +1006,14 @@ "@sentry/utils" "6.7.1" tslib "^1.9.3" -"@sentry/integrations@^6.10.0": - version "6.10.0" - resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-6.10.0.tgz#f8f9e7efd55ec44d0408bd4493df1c9ceabaaa63" - integrity sha512-NMtB0jjFYFZRxyjYu2dWLThk9YPIwqhi4hYywmWkbv4/ILzi5Rwnh+aqNW6yrj8qG4b9itNMh3YvEzmf0aqauw== - dependencies: - "@sentry/types" "6.10.0" - "@sentry/utils" "6.10.0" - localforage "^1.8.1" - tslib "^1.9.3" - -"@sentry/minimal@6.13.3": +"@sentry/integrations@^6.13.3": version "6.13.3" - resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.13.3.tgz#a675a79bcc830142e4f95e6198a2efde2cd3901e" - integrity sha512-63MlYYRni3fs5Bh8XBAfVZ+ctDdWg0fapSTP1ydIC37fKvbE+5zhyUqwrEKBIiclEApg1VKX7bkKxVdu/vsFdw== + resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-6.13.3.tgz#9d80229de6e815c53fa52ca2422a0d13820b8d4e" + integrity sha512-iC8LkbBTxlRo9FNxRqFfEm85FrELltc3E9gFsFSBkCnf7S/3nDCDW+mJX92KpRk97Wqid6/JwlXttKz8lsdF2A== dependencies: - "@sentry/hub" "6.13.3" "@sentry/types" "6.13.3" + "@sentry/utils" "6.13.3" + localforage "^1.8.1" tslib "^1.9.3" "@sentry/minimal@6.7.1": @@ -1079,18 +1040,6 @@ lru_map "^0.3.3" tslib "^1.9.3" -"@sentry/react@^6.13.3": - version "6.13.3" - resolved "https://registry.yarnpkg.com/@sentry/react/-/react-6.13.3.tgz#f9607e0a60d52efd0baa96a14e694b6059f9379a" - integrity sha512-fdfmD9XNpGDwdkeLyd+iq+kqtNeghpH3wiez2rD81ZBvrn70uKaO2/yYDE71AXC6fUOwQuJmdfAuqBcNJkYIEw== - dependencies: - "@sentry/browser" "6.13.3" - "@sentry/minimal" "6.13.3" - "@sentry/types" "6.13.3" - "@sentry/utils" "6.13.3" - hoist-non-react-statics "^3.3.2" - tslib "^1.9.3" - "@sentry/tracing@6.7.1": version "6.7.1" resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-6.7.1.tgz#b11f0c17a6c5dc14ef44733e5436afb686683268" @@ -1102,12 +1051,7 @@ "@sentry/utils" "6.7.1" tslib "^1.9.3" -"@sentry/types@6.10.0": - version "6.10.0" - resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.10.0.tgz#6b1f44e5ed4dbc2710bead24d1b32fb08daf04e1" - integrity sha512-M7s0JFgG7/6/yNVYoPUbxzaXDhnzyIQYRRJJKRaTD77YO4MHvi4Ke8alBWqD5fer0cPIfcSkBqa9BLdqRqcMWw== - -"@sentry/types@6.13.3", "@sentry/types@^6.8.0": +"@sentry/types@6.13.3", "@sentry/types@^6.13.3": version "6.13.3" resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.13.3.tgz#63ad5b6735b0dfd90b3a256a9f8e77b93f0f66b2" integrity sha512-Vrz5CdhaTRSvCQjSyIFIaV9PodjAVFkzJkTRxyY7P77RcegMsRSsG1yzlvCtA99zG9+e6MfoJOgbOCwuZids5A== @@ -1117,14 +1061,6 @@ resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.7.1.tgz#c8263e1886df5e815570c4668eb40a1cfaa1c88b" integrity sha512-9AO7HKoip2MBMNQJEd6+AKtjj2+q9Ze4ooWUdEvdOVSt5drg7BGpK221/p9JEOyJAZwEPEXdcMd3VAIMiOb4MA== -"@sentry/utils@6.10.0": - version "6.10.0" - resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.10.0.tgz#839a099fa0a1f0ca0893c7ce8c55ba0608c1d80f" - integrity sha512-F9OczOcZMFtazYVZ6LfRIe65/eOfQbiAedIKS0li4npuMz0jKYRbxrjd/U7oLiNQkPAp4/BujU4m1ZIwq6a+tg== - dependencies: - "@sentry/types" "6.10.0" - tslib "^1.9.3" - "@sentry/utils@6.13.3": version "6.13.3" resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.13.3.tgz#188754d40afe693c3fcae410f9322531588a9926"