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:
parent
958fe132ae
commit
7a5e32bdf6
@ -24,6 +24,8 @@ import { sentryDsn, isProduction } from "./vars";
|
||||
import { UserStore } from "./user-store";
|
||||
import logger from "../main/logger";
|
||||
|
||||
export let sentryIsInitialized = false;
|
||||
|
||||
/**
|
||||
* This function bypasses webpack issues.
|
||||
*
|
||||
@ -77,6 +79,9 @@ export async function SentryInit(): Promise<void> {
|
||||
},
|
||||
environment: isProduction ? "production" : "development",
|
||||
});
|
||||
|
||||
sentryIsInitialized = true;
|
||||
|
||||
logger.info(`✔️ [SENTRY-INIT]: Sentry for ${process.type} is initialized.`);
|
||||
} catch (error) {
|
||||
logger.warn(`⚠️ [SENTRY-INIT]: Sentry.init() error: ${error?.message ?? error}.`);
|
||||
|
||||
@ -41,7 +41,7 @@ import { FormSwitch, Switcher } from "../switch";
|
||||
import { KubeconfigSyncs } from "./kubeconfig-syncs";
|
||||
import { SettingLayout } from "../layout/setting-layout";
|
||||
import { Checkbox } from "../checkbox";
|
||||
import { sentryDsn } from "../../../common/vars";
|
||||
import { sentryIsInitialized } from "../../../common/sentry";
|
||||
|
||||
enum Pages {
|
||||
Application = "application",
|
||||
@ -259,7 +259,7 @@ export class Preferences extends React.Component {
|
||||
<section id="telemetry">
|
||||
<h2 data-testid="telemetry-header">Telemetry</h2>
|
||||
{telemetryExtensions.map(this.renderExtension)}
|
||||
{sentryDsn ? (
|
||||
{sentryIsInitialized ? (
|
||||
<React.Fragment key='sentry'>
|
||||
<section id='sentry' className="small">
|
||||
<SubTitle title='Automatic Error Reporting' />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user