Skip to content

Commit 11f4407

Browse files
authored
add error handler for api process quit (#83)
1 parent 71867d1 commit 11f4407

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/main.dev.ts

+19-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,25 @@ Sentry.init({
6666

6767
let mainWindow: BrowserWindow | null;
6868
let updateStream: grpc.ClientReadableStream<ConnectionStatusUpdate> | undefined;
69-
const cliProcess = child_process.spawn(pomeriumCli, ['api']);
69+
70+
const cliProcess = child_process
71+
.spawn(pomeriumCli, ['api'])
72+
.on('error', (error) => {
73+
Sentry.captureEvent({
74+
message: 'API process failed to start',
75+
extra: { error },
76+
});
77+
})
78+
.on('close', (code, signal) => {
79+
if (signal != null) return;
80+
Sentry.captureEvent({
81+
message: 'API process unexpectedly quit',
82+
extra: { code },
83+
});
84+
});
85+
86+
cliProcess.stderr.on('data', (data) => console.error(data.toString()));
87+
cliProcess.stdout.on('data', (data) => console.info(data.toString()));
7088
class AppUpdater {
7189
constructor() {
7290
log.transports.file.level = 'info';

0 commit comments

Comments
 (0)