1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Don't show sentry preference if init fails

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2021-07-08 16:25:12 -04:00
parent 958fe132ae
commit 7a5e32bdf6
2 changed files with 7 additions and 2 deletions

View File

@ -24,6 +24,8 @@ import { sentryDsn, isProduction } from "./vars";
import { UserStore } from "./user-store"; import { UserStore } from "./user-store";
import logger from "../main/logger"; import logger from "../main/logger";
export let sentryIsInitialized = false;
/** /**
* This function bypasses webpack issues. * This function bypasses webpack issues.
* *
@ -77,6 +79,9 @@ export async function SentryInit(): Promise<void> {
}, },
environment: isProduction ? "production" : "development", environment: isProduction ? "production" : "development",
}); });
sentryIsInitialized = true;
logger.info(`✔️ [SENTRY-INIT]: Sentry for ${process.type} is initialized.`); logger.info(`✔️ [SENTRY-INIT]: Sentry for ${process.type} is initialized.`);
} catch (error) { } catch (error) {
logger.warn(`⚠️ [SENTRY-INIT]: Sentry.init() error: ${error?.message ?? error}.`); logger.warn(`⚠️ [SENTRY-INIT]: Sentry.init() error: ${error?.message ?? error}.`);

View File

@ -41,7 +41,7 @@ import { FormSwitch, Switcher } from "../switch";
import { KubeconfigSyncs } from "./kubeconfig-syncs"; import { KubeconfigSyncs } from "./kubeconfig-syncs";
import { SettingLayout } from "../layout/setting-layout"; import { SettingLayout } from "../layout/setting-layout";
import { Checkbox } from "../checkbox"; import { Checkbox } from "../checkbox";
import { sentryDsn } from "../../../common/vars"; import { sentryIsInitialized } from "../../../common/sentry";
enum Pages { enum Pages {
Application = "application", Application = "application",
@ -259,7 +259,7 @@ export class Preferences extends React.Component {
<section id="telemetry"> <section id="telemetry">
<h2 data-testid="telemetry-header">Telemetry</h2> <h2 data-testid="telemetry-header">Telemetry</h2>
{telemetryExtensions.map(this.renderExtension)} {telemetryExtensions.map(this.renderExtension)}
{sentryDsn ? ( {sentryIsInitialized ? (
<React.Fragment key='sentry'> <React.Fragment key='sentry'>
<section id='sentry' className="small"> <section id='sentry' className="small">
<SubTitle title='Automatic Error Reporting' /> <SubTitle title='Automatic Error Reporting' />