| 24 | } |
| 25 | |
| 26 | export const initDesktopCrashReporting = (): void => { |
| 27 | if (typeof window === "undefined") return; |
| 28 | const bridge = (window as Window & { readonly executor?: CrashReportingBridge }).executor; |
| 29 | if (typeof bridge?.getCrashReporting !== "function") return; |
| 30 | const init = async () => { |
| 31 | // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: crash reporting must never take the app down with it |
| 32 | try { |
| 33 | const config = await bridge.getCrashReporting?.(); |
| 34 | if (!config?.dsn) return; |
| 35 | const Sentry = await import("@sentry/browser"); |
| 36 | Sentry.init({ |
| 37 | dsn: config.dsn, |
| 38 | release: config.release, |
| 39 | environment: config.environment, |
| 40 | sendDefaultPii: false, |
| 41 | tracesSampleRate: 0, |
| 42 | initialScope: { |
| 43 | tags: { |
| 44 | process: "renderer", |
| 45 | runId: config.runId, |
| 46 | }, |
| 47 | }, |
| 48 | }); |
| 49 | } catch { |
| 50 | // Reporting failures stay silent — there is nowhere left to report them. |
| 51 | } |
| 52 | }; |
| 53 | void init(); |
| 54 | }; |