Skip to content

Commit f7e91a6

Browse files
committed
Silence post-quit error reports
We get a few spurious reports from here, by exceptions thrown during Electron shutdown that don't seem to cause problems or any visible effects.
1 parent a6d9fbc commit f7e91a6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ const createWindow = () => {
8686
});
8787
};
8888

89+
function disableEventReporting() {
90+
Sentry.getCurrentHub().getClient().getOptions().enabled = false;
91+
}
92+
8993
const amMainInstance = app.requestSingleInstanceLock();
9094
if (!amMainInstance) {
9195
console.log('Not the main instance - quitting');
@@ -120,13 +124,16 @@ if (!amMainInstance) {
120124
reportError(error);
121125
}
122126

123-
// We've done our best - now shut down for real
127+
// We've done our best - now shut down for real. Disable errors, otherwise
128+
// we can receive reports for invisible errors during/just after exit.
124129
app.quit();
130+
process.nextTick(disableEventReporting);
125131
});
126132
} else {
127133
// Make sure we clean up the whole group (shell + node).
128134
// https://azimi.me/2014/12/31/kill-child_process-node-js.html
129135
process.kill(-server.pid);
136+
process.nextTick(disableEventReporting);
130137
}
131138
} catch (error) {
132139
console.log('Failed to kill server', error);

0 commit comments

Comments
 (0)