Move initializing sentry to runnable

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2022-12-06 09:18:59 -05:00
1 parent 8410a82596
commit 0460db2e12
2 files changed
+28 -8

No files matched your search

-8
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();
@@ -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;