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

Move initializing sentry to runnable

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-12-01 09:15:39 -05:00
parent 8410a82596
commit 0460db2e12
2 changed files with 28 additions and 8 deletions

View File

@ -38,12 +38,10 @@ import addSyncEntriesInjectable from "./initializers/add-sync-entries.injectable
import hotbarStoreInjectable from "../common/hotbars/store.injectable";
import { bindEvents } from "./navigation/events";
import openDeleteClusterDialogInjectable from "./components/delete-cluster-dialog/open.injectable";
import { init } from "@sentry/electron/renderer";
import kubernetesClusterCategoryInjectable from "../common/catalog/categories/kubernetes-cluster.injectable";
import autoRegistrationInjectable from "../common/k8s-api/api-manager/auto-registration.injectable";
import assert from "assert";
import startFrameInjectable from "./start-frame/start-frame.injectable";
import initializeSentryReportingWithInjectable from "../common/error-reporting/initialize-sentry-reporting.injectable";
configurePackages(); // global packages
registerCustomThemes(); // monaco editor themes
@ -60,12 +58,6 @@ async function attachChromeDebugger() {
}
export async function bootstrap(di: DiContainer) {
const initializeSentryReportingWith = di.inject(initializeSentryReportingWithInjectable);
if (process.isMainFrame) {
initializeSentryReportingWith(init);
}
const startFrame = di.inject(startFrameInjectable);
await startFrame();

View File

@ -0,0 +1,28 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import initializeSentryReportingWithInjectable from "../../common/error-reporting/initialize-sentry-reporting.injectable";
import setupAppPathsInjectable from "../app-paths/setup-app-paths.injectable";
import { beforeFrameStartsInjectionToken } from "../before-frame-starts/before-frame-starts-injection-token";
import { init } from "@sentry/electron/renderer";
const initializeSentryReportingInjectable = getInjectable({
id: "initialize-sentry-reporting",
instantiate: (di) => ({
id: "initialize-sentry-reporting",
run: () => {
// Have to inject this here instead of above so that its dependency on `setupAppPathsInjectable` doesn't throw
const initializeSentryReportingWith = di.inject(initializeSentryReportingWithInjectable);
if (process.isMainFrame) {
initializeSentryReportingWith(init);
}
},
runAfter: di.inject(setupAppPathsInjectable),
}),
injectionToken: beforeFrameStartsInjectionToken,
});
export default initializeSentryReportingInjectable;