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

add comments

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2021-07-08 16:13:23 -04:00
parent e643067d0e
commit 958fe132ae

View File

@ -24,6 +24,11 @@ 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";
/**
* This function bypasses webpack issues.
*
* See: https://docs.sentry.io/platforms/javascript/guides/electron/#webpack-configuration
*/
async function requireSentry() { async function requireSentry() {
switch (process.type) { switch (process.type) {
case "browser": case "browser":
@ -35,7 +40,10 @@ async function requireSentry() {
} }
} }
export async function SentryInit() { /**
* Initialize Sentry for the current process so to send errors for debugging.
*/
export async function SentryInit(): Promise<void> {
try { try {
const Sentry = await requireSentry(); const Sentry = await requireSentry();
@ -69,11 +77,11 @@ export async function SentryInit() {
}, },
environment: isProduction ? "production" : "development", environment: isProduction ? "production" : "development",
}); });
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}.`);
} }
} catch (error) { } catch (error) {
logger.warn(`⚠️ [SENTRY-INIT]: Error loading Sentry module ${error?.message ?? error}.`); logger.warn(`⚠️ [SENTRY-INIT]: Error loading Sentry module ${error?.message ?? error}.`);
} }
} }