Skip to content

Commit 07b8f40

Browse files
committed
Don't let Sentry init failures block desktop startup
1 parent c68b1c0 commit 07b8f40

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

desktop/src/main/index.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,16 @@ logger.info(
3636
logFlagState(true);
3737

3838
if (import.meta.env.VITE_DESKTOP_SENTRY_DSN) {
39-
Sentry.init({
40-
dsn: import.meta.env.VITE_DESKTOP_SENTRY_DSN,
41-
release: global.__SENTRY_RELEASE__,
42-
});
43-
logger.info("[Main] Sentry enabled");
39+
try {
40+
Sentry.init({
41+
dsn: import.meta.env.VITE_DESKTOP_SENTRY_DSN,
42+
release: global.__SENTRY_RELEASE__,
43+
});
44+
logger.info("[Main] Sentry enabled");
45+
} catch (e) {
46+
logger.error("[Main] Failed to initialise Sentry, continuing");
47+
logger.error(e);
48+
}
4449
}
4550

4651
const createWindow = async () => {

desktop/src/renderer/index.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,19 @@ import App from "./App";
3333
import logging from "loglevel";
3434

3535
if (import.meta.env.VITE_DESKTOP_SENTRY_DSN) {
36-
Sentry.init(
37-
{
38-
dsn: import.meta.env.VITE_DESKTOP_SENTRY_DSN,
39-
release: global.__SENTRY_RELEASE__,
40-
},
41-
reactInit,
42-
);
43-
logging.debug("[Renderer] Sentry enabled");
36+
try {
37+
Sentry.init(
38+
{
39+
dsn: import.meta.env.VITE_DESKTOP_SENTRY_DSN,
40+
release: global.__SENTRY_RELEASE__,
41+
},
42+
reactInit,
43+
);
44+
logging.debug("[Renderer] Sentry enabled");
45+
} catch (e) {
46+
logging.error("[Renderer] Failed to initialise Sentry, continuing");
47+
logging.error(e);
48+
}
4449
}
4550

4651
ReactDOM.createRoot(document.getElementById("root")!).render(<App />);

0 commit comments

Comments
 (0)